IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to process FIXED (Non Delimiter File) in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jones.jebaraj84

New User


Joined: 26 Nov 2008
Posts: 10
Location: India

PostPosted: Tue Dec 30, 2008 1:51 am
Reply with quote

I have a question. I have used REXX for Delimited files and the processing is good. But can I use the REXX for processing the FIXED files with specified layouts. For example,

Consider the fixed file as:
Code:
Janet    Jackson   25 USA
Joyce    Winston   24 INDIA

The layout for this file is as below:

First Name - Char(10)
Last Name - Char(10)
Age - Char(3)
Country - Char(10)

Now I have each field in a specified location in the file. Can we use REXX to read this file and then do processing?

Can we use Stem variable to read the record and each field in the record?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Dec 30, 2008 1:58 am
Reply with quote

jones.jebaraj84 wrote:
Can we use REXX to read this file and then do processing?

YES.

jones.jebaraj84 wrote:
Can we use Stem variable to read the record and each field in the record?

NO. You have to use one of the data processing/formatting functions: PARSE, SUBSTR, LEFT, RIGHT, CENTER, WORD, etc.

I'd use PARSE, but that's really your decision.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Dec 30, 2008 2:51 am
Reply with quote

You can read the records into stem a variable. You must break the records into fields. You may put the fields in stem variables if you wish.
Code:
/* REXX READ FIXED LEN FIELDS RECORDS USING STEM */ 
/* TRACE ALL */                                     
TRACE OFF                                           
                                                     
DO UNTIL SYSDSN(FROM_NAME) = "OK"                   
   SAY "PLEASE ENTER 'FROM' DATASET NAME"           
   PULL FROM_NAME                                   
END                                                 
                                                     
"FREE DDNAME(INFILE)"                               
"ALLOCATE DDNAME(INFILE) SHR DSNAME(" FROM_NAME ")" 
"EXECIO * DISKR INFILE (STEM RECD. FINIS"           
"FREE DDNAME(INFILE)"                                       

HOW_MANY = RECD.0                                   

DO REC = 1 TO RECD.0                                 
  PARSE VALUE RECD.REC WITH FNAME.REC 10 ,           
                            LNAME.REC 20 ,           
                            AGE.REC   23 ,                 
                            CNTRY.REC 33 ,                 
                            REST.REC                       
End                                                         
                                                           
SAY 'RECS = ' RECD.0                                       
SAY LNAME.2 ', ' FNAME.2 ' AGE = ' AGE.2 ' CNTRY = ' CNTRY.2
                                                           
EXIT                                                       
Back to top
View user's profile Send private message
jones.jebaraj84

New User


Joined: 26 Nov 2008
Posts: 10
Location: India

PostPosted: Thu Jan 08, 2009 1:38 am
Reply with quote

Thanks... That was really useful... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top