Joined: 24 May 2003 Posts: 5 Topics: 1 Location: Indore
Posted: Sat Aug 21, 2004 11:57 pm Post subject: Need to select variable length fields out of each record
Hi,
I'm having a sequential file of RECFM=FB LRECL=80 like this
AAA..............Group
BBBBB..........Display
CC ...............Display
DDDD ...........Index
There are essentially just two columns. the first column starts with a variable name AAA etc and has a tail of periods that ends at the start of the second column with the variable type. Please note that not every variable is ending with a period, sometimes they end with a space. The maximum length of the variables is fixed because they are actual Working Storage variables in a COBOL program.
I'm intending to supply only the variable names (AAA, BBBBB,CC & so on) out of the above file as an input to the ISRUPC step as shown below:
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Aug 25, 2004 4:23 pm Post subject:
Bugs,
I completely missed this topic. The following JCL will give you the desired results. The generation of SRCHFOR cards gets trickier as the the variables are not of the same length.
I assumed that 8 is the maximum length of the variable. we first change all periods to spaces using ALTSEQ so that it is easier to splitt the records.
Once we converted the periods to spaces we use outfil and outrec to generate the control cards.
Now you can contenate all files (T1 - T8 ) as sysin for the search program. If the variable length is more than 8 bytes then we need to change the control cards a little bit. If you are not able to change the cards , let me know the max length of the variable and I will show the control cards.
Joined: 24 May 2003 Posts: 5 Topics: 1 Location: Indore
Posted: Fri Aug 27, 2004 9:34 pm Post subject: thanks !
Hi Kolusu !
The trick worked and I could successfully modify the control cards for a maximum variable-length of 25 characters. However, I was curious to knowing if a call to a Rexx program to this end would be faster ? Well, I was thinking of pulling the original file as instream data to IRXJCL program that will be passed a PARM='My Rexx pgm". Where "My Rexx pgm" will get the same result as we got with SORT.
I've written the "my rexx pgm" but am unable to post it here at this moment for you perusal.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri May 12, 2006 1:06 pm Post subject:
With z/OS DFSORT PTF UK90007 and DFSORT R14 PTF UK90006 (April, 2006), you can now do this quite easily using the new PARSE and JFY functions, as shown by this DFSORT job:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Extract chars before first '.' or space into %00.
INREC PARSE=(%00=(FIXLEN=30,ENDBEFR=C'.',ENDBEFR=C' ')),
* Create output record as:
* SRCHFOR 'chars'
* Use JFY to add the ' after the last nonblank of chars.
BUILD=(C'SRCHFOR ''',%00,JFY=(SHIFT=LEFT,TRAIL=C''''))
/*
For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:
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