Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to process FIXED (Non Delimiter File) in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to process FIXED (Non Delimiter File) in REXX
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

Moderator Team Head


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

PostPosted: Tue Dec 30, 2008 1:58 am    Post subject: Re: How to process FIXED (Non Delimiter File) in REXX
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us