I have the following requirement which i'm looking for a solution.
I have 3 input files.
File A - Control file in following layout lrecl = 4
RecNo (3 Bytes key field) and Indicator (1 Byte)
Code:
100Y
110N
120N
130N
140Y
150N
File B - Product "Lookup" file in following layout lrecl = 8
Product id (7 bytes Key field) and Product type (1 Byte and values will be A or B)
Code:
1212111A
1212122A
1212133B
1212144A
1212155B
File C- Location "Master" file lrecl = 16
Location id (5 Bytes and Key field), Product ID (7 bytes) and Year (4bytes)
(same product will be available in multiple locations)
I need the file C to be copied to output file D of same layout and same data but the year populated with zeros or values from input file C based on the following condition.
1. If file A rec no 120 has indicator N then always populate zeros to year.
2. If file A rec no 120 has indicator Y, then look for the products in File B for product type, if A then populate year same as available in input and if B populate zeros to year field.
(In file A we should always look for rec no 120 and ignore the remaining records)
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
sqlcode1 wrote:
See if below works...
Run your job with the following scenario's
1. There is no type 120 record FB-4/CONTROL FILE or Empty FB-4/CONTROL
2. More than 1 record for type 120 record with Y and N indicator.
I am not sure as to why you have SYSPRINT,SYSUDUMP,SYSDBOUT DDnames in your JCL. You don't need them.
Parthasarathy,
Use the following JCL which will give you the desired results. This job also takes care of not reading the product file when there is an "n" indicator in the control file.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I am not sure as to why you have SYSPRINT,SYSUDUMP,SYSDBOUT DDnames in your JCL. You don't need them.
sqlcode1,
I would advise only adding SYSUDUMP if you get an ABEND from a DFSORT job and want to look at a dump. SYSPRINT and SYSDBOUT are NOT used by DFSORT.
I have been deleting these DD statements from your posts when I see them. They ARE NOT NEEDED. Please don't use them or post them in your solutions because people will use your JCL as a model and will propagate these unnecessary statements from job to job.
1. There is no type 120 record FB-4/CONTROL FILE or Empty FB-4/CONTROL
2. More than 1 record for type 120 record with Y and N indicator.
Based on sample data, I assumed that Control File would have atleast one and unique type 120 record. Because OP didn't provided that information, I had to make that assumption. I may/could be wrong.
Quote:
I am not sure as to why you have SYSPRINT,SYSUDUMP,SYSDBOUT DDnames in your JCL. You don't need them.
Quote:
I would advise only adding SYSUDUMP if you get an ABEND from a DFSORT job and want to look at a dump. SYSPRINT and SYSDBOUT are NOT used by DFSORT.
I have been deleting these DD statements from your posts when I see them. They ARE NOT NEEDED. Please don't use them or post them in your solutions because people will use your JCL as a model and will propagate these unnecessary statements from job to job.
Thank you for the information and I will take them off next time onwards.
Kolusu,
Based on sample data, I assumed that Control File would have atleast one and unique type 120 record. Because OP didn't provided that information, I had to make that assumption. I may/could be wrong.
In My control file I may or may not have record "120". If I don't have "120" then it should be treated as record with indicator "N" and hence populate zeros to year in output without considering product file.
The control file will never have duplicates on "120".