I want the output like below
header changed to BAN
CAN changed to CTN and CAR changed to CYR
CDN changed to CSR and CDA changed to CGT
CON cahnged to CXT and CBA changed to NMF
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It's not clear if you want to change CAN and CAR only if both appear in the record (if CAN and CAR appear in the record, change both) or independently (if CAN appears, change it. If CAR appears, change it). Assuming independence, here's a DFSORT job that will do what you asked for. If they're not independent, let me know.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Amar,
Yes, that's another way to do it providing the fields are independent.
However, since you're using OVERLAY, you don't have to specify the fields you're NOT changing (that's kind of the point of OVERLAY). So your OVERLAY operand should be:
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
Hi Frank,
There is slight change in the requirement as below, I am finding it difficult to control this type of complex requirement... Please help me out...
Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 IND
20080423CAN380638 C ABCDI04/25/2008CAR70
20080423CAN322156 C DFEEI04/25/2008CARF4
20080423CAN322726 C DFEEI04/25/2008CARF4
20080423CAN829228 C RRTTI04/25/2008CARV4
20080423CAN321708 C DFEEI04/25/2008CARFF4
20080423CAN317303 C DFETI04/25/2008CARF4
20080423CAN322834 C DFETI04/25/2008CARF4
As there is CAN CAR combination is there in all the records
I need the output as
Header change as IND to BAN
For first 3 Records change should happen as CTN and CYR
Next 2 records change should happen as CSR and CGT
Next 2 records change should happen as CXT and NMF
All C is changed to G except for the DFEE and DFET Records
And in the other Output I need the Number of combination changed from
CAN CAR to CTN and CYR
CAN CAR to CSR and CGT
CAN CAR to CXT and NMF
and Number of Records C changed to G
Record count may change every time, So there must be some sort of count in the control card where I can change it every time and Run
In this example Its 3, 2 and 2 it may be next time 4, 5, 6 ....
Code:
----+----1----+----2----+----3----+----4----+----5-
HEADER 20080424 BAN
20080423CTN380638 G ABCDI04/25/2008CYR70
20080423CTN322156 C DFEEI04/25/2008CYRF4
20080423CTN322726 C DFEEI04/25/2008CYRF4
20080423CSR829228 G RRTTI04/25/2008CGTV4
20080423CSR321708 C DFEEI04/25/2008CGTFF4
20080423CXT317303 C DFETI04/25/2008NMFF4
20080423CXT322834 C DFETI04/25/2008NMFF4
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will meet your new requirement. You just need to change the GP1END and GP2END values as the number of records in your groups change. So for example, for the 4,5,6 case, you would change GP1END to 5 and GP2END to 10 (remember to count the header record).
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
* Set GP1END +n value to relative record number of end of group 1
GP1END,+4
* Set GP2END +n value to relative record number of end of group 2
GP2END,+6
/*
//SORTIN DD DSN=... input file (FB/200)
//SORTOUT DD DSN=... output file (FB/200)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=200,
IFTHEN=(WHEN=INIT,OVERLAY=(201:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
OVERLAY=(17:C'BAN'),HIT=NEXT),
IFTHEN=(WHEN=(201,8,ZD,GE,+2,AND,21,4,SS,NE,C'DFEE,DFET'),
OVERLAY=(19:C'G'),HIT=NEXT),
IFTHEN=(WHEN=(201,8,ZD,GE,+2,AND,201,8,ZD,LE,GP1END),
OVERLAY=(9:C'CTN',36:C'CYR')),
IFTHEN=(WHEN=(201,8,ZD,GT,GP1END,AND,201,8,ZD,LE,GP2END),
OVERLAY=(9:C'CSR',36:C'CGT')),
IFTHEN=(WHEN=(201,8,ZD,GT,GP2END),
OVERLAY=(9:C'CXT',36:C'NMF'))
/*
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
And in the other Output I need the Number of combination changed from
CAN CAR to CTN and CYR
CAN CAR to CSR and CGT
CAN CAR to CXT and NMF
and Number of Records C changed to G
It's not clear to me what you're talking about here. Please explain more clearly what other Output you're referring to and what it should look like, what the input looks like, and what you mean by "CAN CAR to CTN and CYR", etc.
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
Hi Frank,
Above JCL is working fine for me.. Excellent logic DFSORT is having in it and you are master in it...
The first out file is as per my requirement
Code:
//SORTOUT DD DSN=... output file (FB/200)
The second output file is that I am talking about the changes got in the first output file by using the Input file
The number of records changed from CAN to CTN
and CAR to CYR
The second output file is that I am talking about the changes got in the first output file by using the Input file
The number of records changed from CAN to CTN
and CAR to CYR
Means is that enough to get the cound of CAN to CTN and CAR to CYR.
You don't need the count of CAN to CSR and CAR to CGT ,
then CAN to CXT and CAR to NMF
then number of records that changed from 'C' to 'G'.
Please post all the counts you require in the another output file.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I think I am more clear now...
It's not clear to me. Please start over for this requirement and give the complete details - example of input records and expected output records, "rules" for getting from input to output, etc.