|
View previous topic :: View next topic
|
| Author |
Message |
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hi All,
Can anyone please help me out for a file comparision and updation,
File - 1
********
Type - VB, LRECL=2000
File - 2
********
Type - VB, LRECL = 80
Output File
***********
Type - VB, LRECL=2000
Condition
*********
1) It need to pull all the records from File - 1 to the output file where the content of 1 to 8 position of file-2 matches with position from 10 to 8 character of file-1.
2) The output file should be formatted for the fetched records with below condition,
a) If the value in position 155 to 1 character is Space, then the value at 155 position needs to update that with Y.
b) If the value in position 180 to 5 character is Space, then the value at 180 position needs to update that with XXXXX.
c) If the value in position 500 to 1 character is Space, then then the value at 500 position needs to update that with Z.
d) If the value in position 1000 to 1 character is Space, then then the value at 1000 position needs to update that with Z.
e) If the value in position 3 is 0, then update the position from 750 to 6 character as PPPPPP. (Even if previously in that field we have some value)
f) If the value in position 3 is 1, then update the position from 750 to 6 character as QQQQQQ. (Even if previously in that field we have some value)
Thanks in advance. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If you search in this part of the forum (DFSORT) there are many examples of JOINKEYS (which will match the files as you want) and then use IFTHEN to change the values you want to change. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
niki,
Use the following DFSORT JCL . Since your input files are VB you need to add 4 bytes of RDW to the start positions of the fields you mentioned.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DISP=SHR,DSN=Your Input VB 2000 Lrecl file
//INB DD DISP=SHR,DSN=Your Input VB 80 Lrecl file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(14,8,A)
JOINKEYS F2=INB,FIELDS=(05,8,A)
REFORMAT FIELDS=(F1:1,4,5)
INREC IFTHEN=(WHEN=(0007,1,CH,EQ,C'0'),
OVERLAY=(0754:C'PPPPPP'),HIT=NEXT),
IFTHEN=(WHEN=(0007,1,CH,EQ,C'1'),
OVERLAY=(0754:C'QQQQQQ'),HIT=NEXT),
IFTHEN=(WHEN=(0159,1,CH,EQ,C' '),
OVERLAY=(0159:C'Y'),HIT=NEXT),
IFTHEN=(WHEN=(0184,5,CH,EQ,C' '),
OVERLAY=(0184:C'XXXXX'),HIT=NEXT),
IFTHEN=(WHEN=(0504,1,CH,EQ,C' '),
OVERLAY=(0504:C'Z'),HIT=NEXT),
IFTHEN=(WHEN=(1004,1,CH,EQ,C' '),
OVERLAY=(1004:C'Z'))
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|