2 digit state code (ex: TX,AR,NV etc..) /* Called as SCODE
3 digit company code (ex: 010,060,070..etc) /* Called as CCODE
3 digit Line code (ex: 088,032,059..etc) /* Called as LCODE
9 digit policy number (ex: 936173500,...etc) /* Called as PNUM
2 digit Record type (ex: 01,03,04,21...etc) note : every policy is a group or records starts with record type 01 only
3 digit Trans type (Ex: BNB,BRN,BEN) /* TTYPE
*Scode CCode Lcode TTYPE PCount /* Note : PCOUNT represents number policies in the respective output file
TX 010 088 BNB 1 /* out of 2 policies in input only 1 policy has to be copied respective output since pcount 1
TX 060 032 BNB 2 /* out of 3 policies in input only 2 policy has to be copied respective output since pcount 2
AR 070 032 BEN 1 /* out of 2 policies in input only 1 policy has to be copied respective output since pcount 1
NV 070 060 BRN 2 /* out of 1 policies in input only 1 policy has to be copied respective output
"userid".scode+ccode+Lcode.timestamp.TTYPE /* since here there are 4 input entires and hence 4 output files
> Since we have 3 cases and hence need to create 3 output file where all the output file should have same attributes of input file.
> PCount is nothing but the number of matched policies need to be there in output file. ex : case1 the o/p 1 should have only 1 policy and o/p file2 should have 2 policies
The o/p file1 should conatin only 1 policy since PCOUNT is 1 and when scode is "TX" and TTYPE is "BNB" is matched in input file.
so (policy1, policy2 & policy4 matched but output file should contain only one policy since pcount is 1 and so all the corresponding policy records
You mention the RECFM as VB , do you want the output also to be VB?
What is the LRECL of the input and output files?
The file attributes of input and output should be the same and LRECL=6004
How many Input files do you have? 1 or 2 ? Explain the rules for getting from input to output.
Its 2 input file. One is data file and consider its I/p file1 and another one I mentioned in sysin as I/P file2. So please treat sysin as another input dataset. My input data file will contains policy details. Each policy is a set of records and number of records in each policy is not consitant but starting rec will be identified by RTYPE with 01.
Explain how PCOUNT is determined.
PCount is nothing but the number of matched policies need to be there in output file.
ex : case1 the o/p 1 should have only 1 policy and o/p file2 should have 2 policies
What is the position and format of the fields scode+ccode+Lcode.timestamp.TTYPE ?
This is the naming convention of output dataset "userid."scode""ccode""Lcode".timestamp.TTYPE
Is the number of output files also variable? Like do you want to create 100's of files for each unique key combo?
Also, what if the input has several thousand policies? Do you intend to create a separate output file for every policy?
No. We will create the number of output files based on no of I/P file2 entries... In this case it contains only 3 records. In generally I/P file2 will not contains more than 8 entries per day. But the PCount will be huge
The following DFSORT JCL will give you the desired results. Since you did not give me the positions of the fields involved , I had assumed them as follows
Scode at position 5 (inclusive of RDW)
Ccode at position 7 (inclusive of RDW)
Lcode at position 10 (inclusive of RDW)
PNUM at position 13 (inclusive of RDW)
RTYPE at position 22 (inclusive of RDW)
TTYPE at position 24 (inclusive of RDW)
the records looks like this
A brief explanation of the job.
The STEP0100 step takes in your pull file(sysin as you used) data records and creates include cards for OUTFIL files and create a temp file called C1. Since you said the max number of records in pull file is 8 , I used STOPAFT=8.
The STEP0200 step generates the sequencing of policy numbers using inrec/outrec. We also concatenate the file created from step0100 to split the records into various files.