MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need to select variable length fields out of each record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Bugs
Beginner


Joined: 24 May 2003
Posts: 5
Topics: 1
Location: Indore

PostPosted: Sat Aug 21, 2004 11:57 pm    Post subject: Need to select variable length fields out of each record Reply with quote

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:
Code:

SRCHFOR 'AAA'
SRCHFOR 'BBBBB'
SRCHFOR 'CC'
SRCHFOR 'DDDD'


Would you please give me a hint in order to achieving the aforementioned results using SyncSort or DFSORT ?
Any hint will be most welcome !
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Aug 25, 2004 4:23 pm    Post subject: Reply with quote

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.

Code:

//STEP0100 EXEC PGM=SORT                                         
//*                                                             
//SYSOUT    DD SYSOUT=*                                         
//SYSPRINT  DD SYSOUT=*                                         
//SORTIN    DD *                                                 
AAA..............GROUP                                           
BBBBB..........DISPLAY                                           
CC ...............DISPLAY                                       
DDDD ...........INDEX                                           
//T1       DD SYSOUT=*                                           
//T2       DD SYSOUT=*                                           
//T3       DD SYSOUT=*                                           
//T4       DD SYSOUT=*                                           
//T5       DD SYSOUT=*                                           
//T6       DD SYSOUT=*                                           
//T7       DD SYSOUT=*                                           
//T8       DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  OUTREC FIELDS=(1,80,TRAN=ALTSEQ)                               
  ALTSEQ CODE=(4B40)                                             
  OUTFIL FNAMES=T1,INCLUDE=(2,7,CH,EQ,C' '),                     
  OUTREC=(C' SRCHFOR ',X'7D',1,1,X'7D',80:X)                     
  OUTFIL FNAMES=T2,INCLUDE=(2,1,CH,NE,C' ',AND,3,6,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,2,X'7D',80:X)                     
  OUTFIL FNAMES=T3,INCLUDE=(3,1,CH,NE,C' ',AND,4,5,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,3,X'7D',80:X)                     
  OUTFIL FNAMES=T4,INCLUDE=(4,1,CH,NE,C' ',AND,5,4,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,4,X'7D',80:X)                     
  OUTFIL FNAMES=T5,INCLUDE=(5,1,CH,NE,C' ',AND,6,3,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,5,X'7D',80:X)                     
  OUTFIL FNAMES=T6,INCLUDE=(6,1,CH,NE,C' ',AND,7,2,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,6,X'7D',80:X)                     
  OUTFIL FNAMES=T7,INCLUDE=(7,1,CH,NE,C' ',AND,8,1,CH,EQ,C' '), 
  OUTREC=(C' SRCHFOR ',X'7D',1,7,X'7D',80:X)                     
  OUTFIL FNAMES=T8,INCLUDE=(8,1,CH,NE,C' '),                     
  OUTREC=(C' SRCHFOR ',X'7D',1,8,X'7D',80:X)                     


The output of this job will be
Code:

 SRCHFOR 'CC'
 SRCHFOR 'AAA'
 SRCHFOR 'DDDD'
 SRCHFOR 'BBBBB'



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.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bugs
Beginner


Joined: 24 May 2003
Posts: 5
Topics: 1
Location: Indore

PostPosted: Fri Aug 27, 2004 9:34 pm    Post subject: thanks ! Reply with quote

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.

I appreciate your help !!

Thanks a lot
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri May 12, 2006 1:06 pm    Post subject: Reply with quote

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:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group