|
View previous topic :: View next topic
|
| Author |
Message |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Hello All ,
I have two fixed block input files .
FILE 1 = FB 40 byte
FILE 2 = FB 24 byte
output file
FILE3 = FB 24 byte
Here are the rules
1) if File 1 is empty no processing . Simple copy FILE2 to FILE3
2) if File 1 field starting from 7 column(Length 2 BYTE) is equal to FILE 2 FIELD STARTING FROM 23 BYTE(LENGTH 2 BYTE) .Then File 2 (23rd to 25 th byte should be replaced with File 1 (10 to 11 byte) and written to a new output file(file3) same attribute as of file 2
3) IF other case record from file 2 should be written to (file3)
here is the example
FILE 1
| Code: |
=COLS> ----+----1----+----2----+----3----+----4
****** ***************************** Top of Dat
000001 111111XXYY
000001 111111ZZAA
****** **************************** Bottom of D |
FILE2
| Code: |
=COLS> ----+----1----+----2----
****** ************************
000001 00000000 00XX
000002 11111111 99ZZ
000003 22222222 88M3 |
output should be (file3)
| Code: |
=COLS> ----+----1----+----2----
****** *************************
000001 00000000 00YY
000002 11111111 99AA
000003 22222222 88M3 |
Regards |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Can file1 or file2 have duplicates for 2byte field shown? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
shr_amar,
Here's a DFSORT JOINKEYS job that will do what I think you're asking for. You'll need the Nov, 2009 PTF to use JOINKEYS. If you don't have that PTF, ask your System Programmer to install it.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file (FB/40)
//IN2 DD DSN=... input file (FB/24)
//SORTOUT DD DSN=... output file (FB/24)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(7,2,A)
JOINKEYS F2=IN2,FIELDS=(23,2,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,24,F1:9,2,?)
SORT FIELDS=(1,8,CH,A)
OUTFIL IFOUTLEN=24,
IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),
OVERLAY=(23:25,2))
/*
|
|
|
| Back to top |
|
 |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Hello Sambhaji
It cannot be duplicate . |
|
| Back to top |
|
 |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Hello Frank,
I m not sure whether Nov, 2009 PTF to use JOINKEYS is present in my shop. i will check . But do we have any other way .Secondly the code which you have given me will work if FILE 1 is empty.
Regds |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
First, check to see if you have the Nov, 2009 PTF. If not, we can discuss the possibility of another way (I'd have to spend time thinking about it and I'd rather not if you can use JOINKEYS).
The DFSORT job will copy all of the records in input file2 to the output file if input file1 is empty. |
|
| Back to top |
|
 |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Hello Frank ,
I am getting the below error :-
| Code: |
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 09:34
JOINKEYS F1=IN1,FIELDS=(7,2,A)
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
JOINKEYS F2=IN2,FIELDS=(23,2,A)
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
JOIN UNPAIRED,F2
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
REFORMAT FIELDS=(F2:1,24,F1:9,2,?)
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
SORT FIELDS=(1,8,CH,A)
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTFIL IFOUTLEN=24,
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),
IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OVERLAY=(23:25,2))
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT
ICE751I 0 C5-K48846 C6-K90014 E7-K48846
ICE052I 3 END OF DFSORT |
|
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
shr_amar,
If you were to take a wild guess what this message means, what would your guess be and how would you correct it?
| Quote: |
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
shr_amar,
If you go back to the job I posted, you'll see that I have blanks at the start of each line in //SYSIN. You don't. That's what the message
BLANK NEEDED IN COLUMN 1 is telling you.
However, C6-K90014 tells me that you don't have the Nov, 2009 PTF so you can't use JOINKEYS. Ask your System Programmer to install that PTF (it's free). For more information on the PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174 |
|
| Back to top |
|
 |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Many Thanks FRANK ,
See i have used the same way you have sugessted . Seems that this is due to PTF .
As it will time to take approval to install PTF . As this is urgent can we have some other way to acheive this ?
| Code: |
000010 //SYSIN DD *
000012 JOINKEYS FILES=F1,FIELDS=(7,2,A)
000013 JOINKEYS FILES=F2,FIELDS=(23,2,A)
000014 JOIN UNPAIRED,F2
000015 REFORMAT FIELDS=(F2:1,24,F1:9,2,?)
000016 SORT FIELDS=(1,8,CH,A)
000017 OUTFIL IFOUTLEN=24,
000018 IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),
000019 OVERLAY=(23:25,2))
000020 /* |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
shr_amar,
The following DFSORT/ICETOOL JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN40 DD DSN=Your 40 byte unq file,DISP=SHR
//IN24 DD DSN=Your 24 byte unq file,DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2 DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN40) USING(CTL1)
COPY FROM(IN24) USING(CTL2)
SORT FROM(T1) USING(CTL3)
SORT FROM(T2) USING(CTL4)
//*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,BUILD=(21:9,2,7,2,C'1')
//*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(25:C'2')
//*
//CTL3CNTL DD *
SORT FIELDS=(23,2,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(27:SEQNUM,1,ZD,RESTART=(23,2))),
IFTHEN=(WHEN=GROUP,BEGIN=(27,1,ZD,EQ,1),PUSH=(26:25,1,28:21,2))
OUTFIL FNAMES=T2,IFOUTLEN=24,INCLUDE=(25,2,ZD,GE,21),
IFTHEN=(WHEN=(25,2,ZD,EQ,21),OVERLAY=(23:28,2))
//*
//CTL4CNTL DD *
SORT FIELDS=(1,8,CH,A),EQUALS
OUTFIL FNAMES=OUT
//* |
|
|
| Back to top |
|
 |
shr_amar Warnings : 2 Active User
.jpg)
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
| Thanks Kolusu .. This is working |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|