PSF for AIX: ASCII to EBCDIC transform -- questions on

ITEM: RTA000102511



Q:                                                                              
ABSTRACT:     PSF for AIX: ASCII to EBCDIC transform -- questions on            
              modifying and recompiling apka2e or asciinpe                      
SEARCH ARG:   psf/aix                                                           
TOPIC THREAD: PRINT                                                             
              PSF/AIX                                                           
..                                                                              
Before I tell my customer that he has to purchase and install the C             
compiler, I want to make sure I've got this right.                              
                                                                                
The issue is printing with fonts using code pages other than 037/850.           
In my case the Hebrew ASCII code page is 856 and the EBCDIC coded font          
uses codepage 424. So I think what I have to do is:                             
                                                                                
1) Edit the /usr/lpp/psf/acif/apka2e.c input user exit and change              
   the appropriate line to:                                                     
      iconv_fd = iconv_open( "IBM-424", "IBM-856");                             
2) Recompile the source.                                                        
                                                                                
Questions:                                                                      
1) Is that it ?                                                                 
2) Is it true that AIX V4.1 does not include the C compiler and just            
   to make this one change I'll have to install the compiler ?                  
3) Could you please run thru the actual compile process (no mention             
   of how it's done in my new bible "AIX for Users of PSF") ?                   
4) Can I rename the resulting executable apknew or must the source              
   file be renamed; what does one do with the Makefile file - I know            
   it has something to do with the compile process but it's been about          
   eight years since I attended a course in C.                                  
                                                                               
A:                                                                              
Let me answer your second question first.                                       
                                                                                
R2) It is true that AIX V4 unbundled a number of products, including            
the C compiler.  If this is the only reason your customer needs the             
compiler, I'd hate for your customer to incur this expense.  Perhaps            
you can find a local RS/6000 with a C compiler and do the work yourself,        
either as an inexpensive services offering or as part of the marketing          
effort. (Or perhaps I can help you out this once.)                              
                                                                                
R1,3,4) Here are the instructions to do what you're asking.  The same           
approach would work for the asciinpe input record exit for ACIF                 
(with a different line number for the affected command, of course).             
                                                                                
Also, if there's no existing AIX converter for the codepage pairs you          
need, or if you're not happy with the existing mapping, you can use             
the AIX genxlt command to generate new conversion tables.  I've not             
included those instructions, but if you're interested, let me know.             
                                                                                
**********************************************************************          
                                                                                
Here's the info on recompiling the apka2e exit to call a different              
iconv conversion pair:                                                          
                                                                                
It is straightforward to create your own version of the apka2e exit             
to convert from one codepage to another. The apka2e exit uses the AIX           
iconv program to do the ASCII-to-EBCDIC translation.  You can find a            
complete list of the codepage pairs that iconv supports in the                  
/usr/lib/nls/loc/iconvTable directory.  (In AIX V4, the files that              
appear will depend on the features you selected at AIX install time.)          
                                                                                
Once you determine the appropriate pair for your needs, you basically           
copy and modify the apka2e.c source file and recompile it under a new           
name.                                                                           
                                                                                
For example:                                                                    
                                                                                
 1) cd /usr/lpp/psf/acif                                                        
 2) cp apka2e.c apknew.c                                                        
 3) vi apknew.c                                                                 
 4) Change line 98 to point to the iconv transforms you wish this               
    exit to invoke (for example, to convert from ISO8859-1 (ASCII)              
    to IBM-500 (EBCDIC) you would change line 98 to read:                       
                                                                                
      iconv_fd = iconv_open( "IBM-500", "ISO8859-1" );                         
                                                                                
 5) Save the file.                                                              
 6) cp Makefile Makefile.bak                                                    
 7) vi Makefile and edit as follows:                                            
                                                                                
    - On line 44 that begins with the word "TARGETS", change this to            
                                                                                
      TARGETS = apknew                                                          
                                                                                
    - Replicate the two lines, 48 and 49, that begin with "apka2e:" so          
      that you have two copies of those lines.  On the first set of             
      those lines, change "apka2e" to "apknew"--twice on the first line         
      and once on the second line, so that you now have a set of lines          
      beginning at line 48 that look like:                                      
                                                                               
      apknew: apknew.c apkexits.h /usr/include/iconv.h                          
                  $(CC) $(CFLAGS) -o $@ apknew.c -e INPEXIT -liconv             
                                                                                
      apka2e: apka2e.c apkexits.h /usr/include/iconv.h                          
                  $(CC) $(CFLAGS) -o $@ apka2e.c -e INPEXIT -liconv             
                                                                                
 8) Save the file.                                                              
 9) At the AIX command prompt, type the command "make".  That will              
    recompile all the user exits listed on the TARGETS statement in             
    the Makefile.  You should end up with an "apknew" executable file           
    in the current directory (/usr/lpp/psf/acif).                               
10) Copy the "apknew" executable to /usr/lpp/psf/bin.                           
11) Ensure the permissions are at least 755 (-rwxr-xr-x):                       
                                                                                
    chmod 755 /usr/lpp/psf/bin/apknew                                          
                                                                                
12) Ensure the group is "printq"                                                
                                                                                
    chgrp printq /usr/lpp/psf/bin/apknew                                        
                                                                                
13) Run acif/line2afp with your new inpexit=/usr/lpp/psf/bin/apknew.            
                                                                                
I hope this helps.                                                              
                                                                                
S e a r c h - k e y w o r d s:                                                  
AIX ICONV APKA2E ASCIINPE GENXLT EBCDIC INPEXIT PSF psf/6000 psf/aix            
infoprint apka2e.c asciinpe.c ascii                                             
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000102511 ITEM: RTA000102511
Dated: 12/1998 Category: XPSF6000
This HTML file was generated 99/06/24~12:43:33
Comments or suggestions? Contact us