|
View previous topic :: View next topic
|
| Author |
Message |
Binop B
Active User

Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi All,
Have mentioned my requirement below. Its not really necessary to do this using DFSORT but I am thinking this could be done using JOINKEY. Please correct me if my understanding is wrong and if possible then how to get this done using JOINKEY.
File1 (Variable file) has some detailed information which needs to be put into the extract.
A field in the record to be set as 'Y' if
1. If the KEY in File1 is available in File2 (Variable file)
2. If value in 55 pos is 'XX'
The output extract (Variable file) hence would have the same no. of records as in File1 and some of records would have to be edited if the above conditions are satisfied.
File1
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
XXX 111111111 XXXXXXXXXX 20130419.. ±.... SYS XXXX
XXX 222222222 XXXXXXXXXX 20130419.. ±.... EA SYS XXXX
XXX 333333333 XXXXXXXXXX 20130419.. ±.... NA SYS XXXX
XXX 444444444 XXXXXXXXXX 20130419.. ±.... SYS XXXX
|
File2
| Code: |
----+----1----+----2----+----3----+----4
..P.222222222 000.NORTH00.Ì0000000....00
.*P.333333333 000.HOGAN00.Ì2000000....00 |
Output
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
XXX 111111111 XXXXXXXXXX 20130419.. ±.... SYS XXXX
XXX 222222222 XXXXXXXXXX 20130419.. ±.... EA SYS XXXX Y
XXX 333333333 XXXXXXXXXX 20130419.. ±.... NA SYS XXXX
XXX 444444444 XXXXXXXXXX 20130419.. ±.... SYS XXXX
|
This is what I have tried so far...
| Code: |
//SORT EXEC PGM=SORT
//SORTJNF1 DD DISP=SHR,DSN=File1
//SORTJNF2 DD DISP=OLD,DSN=File2
//SORTOUT DD DSN=Output,
// DISP=(NEW,CATLG),UNIT=SYSDA,DCB=(LRECL=1124,RECFM=VB)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(13,9,A)
JOINKEYS FILE=F2,FIELDS=(9,9,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:5)
OPTION COPY
OUTFIL FNAMES=SORTOUT,IFTHEN=(WHEN=(59,2,CH,EQ,C'EA'),
OVERLAY=(79:C'Y'))
// |
I am facing multiple issues ..
1. First I am not able to get the REFORMAT card correctly because of the variable length. Gives me a SYNTAX error with the current one as mentioned above. I am able to get an output file if I make the output file a FB
2. Not sure how to give the condition. I want all the records from File1.
Please do let me know if I have missed to give or if I need to give more information... |
|
| Back to top |
|
 |
Binop B
Active User

Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
| Binop B wrote: |
| 2. If value in 55 pos is 'XX' |
Ooops.. this is 'EA' |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following control cards which will give you the desired results
| Code: |
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(13,9,A)
JOINKEYS F2=INB,FIELDS=(09,9,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,4,?,F1:5)
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'B',AND,60,2,CH,EQ,C'EA'),
OVERLAY=(80:C'Y'))
OUTREC BUILD=(1,4,6)
//* |
|
|
| Back to top |
|
 |
Binop B
Active User

Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Skolusu,
Thanks a ton... I was able to build the output file as required... Thanks again...  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|