Migrating From an IBM Mainframe to a UNIX Box with Easytrieve Report Generator
search cancel

Migrating From an IBM Mainframe to a UNIX Box with Easytrieve Report Generator

book

Article ID: 55929

calendar_today

Updated On: 11-04-2024

Products

Easytrieve Report Generator

Issue/Introduction

Are you an Easytrieve customer looking for a way to convert UNIX files from EBCDIC to ASCII (and vice versa) at a field level? The files being transferred to UNIX will have to undergo field level conversion of the alpha fields ONLY from EBCDIC to ASCII. Easytrieve UNIX ships a UNIX-specific version of Easytrieve Toolkit with the macros to accomplish the task.

MIGRATION CONSIDERATIONS

  1. migrate a program
  2. migrate a file
  3. convert EBCDIC to ASCII
  4. ftp note

 

Resolution

MIGRATE A PROGRAM

The basic procedure to migrate an Easytrieve Plus program from the mainframe to any UNIX\LINUX box is to ftp the program(s) from the mainframe PDS to a UNIX\LINUX directory in ASCII format (not BIN). Remove the leading and trailing JCL. Revise the PARM and any hard coded hexadecimal EBCDIC statements. Compile and edit until all compile errors have been resolved. You can practice by following these exact steps.

  1. log on to your UNIX\LINUX box
  2. make a migrate directory e.g. mkdir migrate_programs
  3. make migrate_programs the current directory e.g. cd migrate_programs
  4. ftp your_mainframe_box
  5. enter your mainframe user_id
  6. enter your mainframe password
  7. make the PDS the current directory e.g. cd 'xxx.abcdefg.eztpls'
  8. prompt
  9. mget *
  10. quit
  11. rename UNIXPROG to an EZT+ name e.g. cp UNIXPROG1 unix1.ezt
  12. edit the program e.g. vi unix1.ezt
  13. Review and revise all code that contains hexadecimal EBCDIC values and change to the appropriate ASCII value e.g. 1 - 9 in EBCDIC is F0 - F9 in ASCII is 30 - 39.
  14. delete the leading mainframe JCL
  15. delete the trailing mainframe JCL
  16. PARM LINK gives a warning if compiled so you may want to move the cursor back up to the top and delete the PARM or rewrite it without the LINK
  17. quit and save your changes e.g. :wq
  18. compile e.g. ezt +L unix1.ezt
  19. if there are errors review the compiled output listing e.g. vi unix1.lst
  20. correct the compiler errors using vi e.g. vi unix1.ezt
  21. repeat step 17 - 20 until there are no more compiler errors

MIGRATE A FILE

The basic procedure to migrate a flat EBCDIC file from the mainframe to any UNIX\LINUX box is to ftp the file(s) from the mainframe to a UNIX\LINUX directory in binary format (bin). You can practice by following these exact steps.

  1. log on to your UNIX\LINUX box
  2. make a migrate directory e.g. mkdir migrate_files
  3. make migrate_files the current directory e.g. cd migrate_files
  4. ftp your_mainframe_box
  5. enter your mainframe userid
  6. enter your mainframe password
  7. since this is a file set to bin e.g. bin
  8. get 'mainframe_file_name' PERSNL1
  9. quit
  10. run a test e.g. ezt unix1.ezt followed by a.out or write a compile script e.g. ezt +L -o $1 $1.ezt
  11. $1
  12. the numbers in the output report should look correct, however the alphabetic characters will be strange looking because the alphabetic characters are EBCDIC

CONVERT EBCDIC TO ASCII

The EBCDIC file(s) transferred to the UNIX\LINUX box in binary format to maintain the integrity of the numeric and packed field values. The problem is that the alphabetic data is in EBCDIC format and when printed it prints unexpected characters and symbols. The solution is to write an Easytrieve Plus program on the UNIX\LINUX box that uses the /toolkit macro %CONVEA. The purpose of the %CONVEA macro is to convert EBCDIC data to ASCII. Additionally write a shell script to automate the compile and execute procedure.

PROGRAM to convert EBCDIC to ASCII

/home/CAI/userid/migrate :$ cat convert1.ezt                    
FILE PERSNL1 F (150)                                             
REGION         1       1 N                                       
BRANCH         2       2 N                                       
NAME-LAST     17       8 A     HEADING('LAST' 'NAME')            
NAME-FIRST    25       8 A     HEADING('FIRST' 'NAME')           
PAY-GROSS     94       4 P 2   HEADING('GROSS' 'PAY')            
FILE CONVERT F (150)                                             
CREGION        1       1 N                                       
CBRANCH        2       2 N                                       
CNAME-LAST    17       8 A                                       
CNAME-FIRST   25       8 A                                       
CPAY-GROSS    94       4 P 2                                     
JOB INPUT PERSNL1                                                
PRINT RPT1                                                       
%CONVEA DBFILE STARTPOS NAME-LAST LENGTH 77                      
PUT CONVERT FROM PERSNL1                                         
REPORT RPT1 LINESIZE 80                                          
SEQUENCE REGION BRANCH NAME-LAST                                 
  TITLE 'READING THE UN-CONVERTED FILE'                          
  LINE 1 REGION BRANCH NAME-FIRST NAME-LAST PAY-GROSS            
JOB INPUT CONVERT                                                
PRINT RPT2                                                       
REPORT RPT2 LINESIZE 80                                          
SEQUENCE CREGION CBRANCH CNAME-LAST                          
  TITLE 'READING THE CONVERT FILE'                           
  LINE CREGION CBRANCH CNAME-FIRST CNAME-LAST CPAY-GROSS    
   

SCRIPT to compile and include a /toolkit macro

ezt +L -I/home/CAI/abcdefg/ez014b/toolkit -o $1 $1.ezt /home/CAI/abcdefg/ez014b
/toolkit/libezttool.a
$1

FTP NOTE:

If you want to FTP multiple files at once:

  1. log on to your UNIX\LINUX box
  2. make a migrate directory e.g. mkdir migrate
  3. make migrate the current directory e.g. cd migrate
  4. ftp usildamd.ca.com
  5. enter your mainframe pmf id
  6. enter your mainframe password
  7. make the PDS the current directory e.g. cd 'csrs.abcdefg.eztpls'
  8. prompt
  9. mget *
  10. quit