Page 1 of 2

Need help in using parsing variable length records and copy

PostPosted: Fri Aug 07, 2015 3:41 pm
by gauravfrankly
Hi All,
I have the following requirement :
1. Variable record length input file of format
companyName|Company no|Surname|DOB|Firstname|Age|KeyINfo
this fill have the tow types of records
for INDIVDUAL and BUSINESS.
If company name is present then that record should be written into BUSINESS file(output file variable length block)
and IF comapnay name is not present and Surname is present then records need to be written into INDIVIDUAL file(outputfie).
Have to perform this using SORT JCL
INDIVIDUAL record : | |verma|26-10-1990| |23|abc
BUSINESS record : abc corp||||||xyz
please gicve me hint to write JCL.
facing issue to categories the records...
Thanks!!

Re: Need help in using parsing variable length records and c

PostPosted: Fri Aug 07, 2015 4:31 pm
by BillyBoyo
You don't need to use PARSE because the company-name is the first field. If there is no company-name, there is a pipe in position one. So use that.

  OPTION COPY
  OUTFIL FNAMES=PRIV,INCLUDE=(1,1,CH,EQ,C'|')
  OUTFIL FNAMES=BUS,SAVE


The SAVE on OUTFIL will send to that file all records which don't appear on another OUTFIL, like an "else, only if on no other OUTFIL, put them here".

Re: Need help in using parsing variable length records and c

PostPosted: Fri Aug 07, 2015 6:31 pm
by gauravfrankly
Thanks Billy. I also have one more query regarding use of FINDREP, shall I ask here?

Re: Need help in using parsing variable length records and c

PostPosted: Fri Aug 07, 2015 7:14 pm
by Terry Heinze
Ask in this forum (DFSORT/ICETOOL/ICEGENER) but ask it as a new topic.

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 10:59 am
by gauravfrankly
Hi Billy,
I need to convert this VB file into 2 diffeerent FB files, INDV and BUSN. and need to remove delimeter '|'.
Output file will be FB,
with following I m not able to remove delimeters.
//STEP10   EXEC PGM=SORT                                         
//SORTIN   DD DSN=INPUT.FILE.1, DISP=OLD   
//SORTOUT1 DD DSN=OUTPUT.FILE,                       
//            DISP=(NEW,CATLG,DELETE),                         
//            DSORG=PS,                                         
//            RECFM=FB,                                         
//            LRECL=440,                                       
//            BLKSIZE=27720,                                   
//            DATACLAS=STANDARD                                 
//SYSPRINT DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  OUTFIL FNAMES=SORTOUT1,VTOF,                                   
  OUTREC=(1:1,440)

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 11:38 am
by BillyBoyo
Just removing the delimiter would be easy with FINDREP, but then you don't really want to only do that, because then you'll never be able to find the data.

You need to use PARSE, to make each delimited input field a fixed-length PARSEd field, and then BUILD your output records from the PARSEd fields.

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 3:33 pm
by gauravfrankly
Thanks Billy,
Can I use OUTFIL fnames inlcude() parse()in single statement.

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 3:47 pm
by gauravfrankly
Billy,
Can I do following two things in single SORT card(input file VB)
1. categories records into BUSN and INDV file using include
2. changes VB records to FB using Parse.

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 4:04 pm
by gauravfrankly
My SORT CARD
//STEP010  EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SYSPRINT DD SYSOUT=*                             
//SORTIN   DD DSN=TTYA.VERMGAU.INPUT,DISP=SHR     
//INDV     DD DSN=TTYA.VERMGAU.INDV,               
//        DISP=(MOD,CATLG),                       
//        DCB=(RECFM=VB,LRECL=300,BLKSIZE=24900), 
//        SPACE=(TRK,(10,10),RLSE),UNIT=SYSDA     
//BUSN     DD DSN=TTYA.VERMGAU.BUSN,               
//        DISP=(MOD,CATLG),                       
//        DCB=(RECFM=VB,LRECL=300,BLKSIZE=24900), 
//        SPACE=(TRK,(10,10),RLSE),UNIT=SYSDA     
//SYSIN    DD *                                   
       OPTION COPY                                 
       OUTFIL FNAMES=INDV,INCLUDE=(1,1,CH,EQ,C'|')
       OUTFIL FNAMES=BUSN,SAVE                     
/*                                                 

My input :
ABC CORP|12345|||||KEYINFO-1|11111
GRV CORPORATION|1123|||||KEY INFO-2|121
PCS PRIVATLIMITEDCOMPANY||||||11123345|123
||VERMA|GAURAV|10/10/1992|M|KEY INFO-INDV1|000123
||GUPTA|RAVI|12/12/1965|M|KEY INDV INFO|000223

OUTPUT;
got all records into BUSN only, no recprds are present in to INDV dataset

Code'd

Re: Need help in using parsing variable length records and c

PostPosted: Tue Aug 18, 2015 4:26 pm
by BillyBoyo
Please use the Code tags to preserve spacing for JCL, Control Cards and data.

You show your output datasets as variable-length. Your input must be variable-length as well. So you are currently looking at the first byte of the RDW each variable-length record is prefixed by. You need to change your INCLUDE= to (5,1....).