MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
John Corbin Beginner Joined: 23 Jan 2004 Posts: 38 Topics: 21
Posted: Mon May 01, 2006 9:55 am Post subject: Record layouts of REXX input files
HI..
I know in REXX that I have done my input files are structured so that a record has its individual parts separated by a ','.
Thus in your REXX you can code something like this:
DO K = 1 to RECCOUNT
PARSE VAR KF1240IN.K,
GSTACNT.K','DCMTLOCNBR.K','AMOUNT.K
etc
etc
What happens when there are no commas separating the record elements ?
I do have access to the record layout via DCLGENs but am not sure how to use this info in REXX
Back to top
superk Advanced Joined: 19 Dec 2002 Posts: 684 Topics: 5
Posted: Mon May 01, 2006 10:06 am Post subject:
You can use the SUBSTR function to pull-out specific fields.
GSTACNT.K = SUBSTR(KF1240IN.K,1,10)
DCMTLOCNBR.K = SUBSTR(KF1240IN.K,30,70)
AMOUNT.K = SUBSTR(KF1240IN.K,100,30)
You can PARSE using spaces as the field delimiter, or any other character as the field delimiter.
PARSE VAR KF1240IN.K,
GSTACNT.K DCMTLOCNBR.K AMOUNT.K
PARSE VAR KF1240IN.K,
GSTACNT.K';'DCMTLOCNBR.K';'AMOUNT.K
You can PARSE using specific column locations
PARSE VAR KF1240IN.K,
1 GSTACNT.K 30 DCMTLOCNBR.K 100 AMOUNT.K
PARSE VAR 1 KF1240IN.K,
1 GSTACNT.K +30 DCMTLOCNBR.K +70 AMOUNT.K
Back to top
John Corbin Beginner Joined: 23 Jan 2004 Posts: 38 Topics: 21
Posted: Mon May 01, 2006 10:16 am Post subject:
I should have thought of that.. thanks
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum