|
View previous topic :: View next topic
|
| Author |
Message |
Divyananda
New User
Joined: 11 Dec 2008 Posts: 9 Location: Chennai
|
|
|
|
Hi All,
I need to merge/concatenate two files- file-1 and file-2 which are of type FB (fixed block) and diffferent record lenght, into a single file (file-3) of type FB, and also insert some text before the start and end of records of file-1 and file-2 in the merged file, in order to identify them in the program easily.
For example consider records in file-1 and file-2 which are of different record length need to be merged into file-3:
File-1 attributes are record length 380 and FB
| Code: |
000xxxxxxxx
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
001xxxxxxxxx
|
File-2 attributes are record length 400 and FB
| Code: |
000xxxxxxxxx
100ddddddddddddddddddddd
100ddddddddddddddddddddd
100ddddddddddddddddddddd
100ddddddddddddddddddddd
001xxxxxxxxx
|
After the contents of file-1 and file-2 are merged/concatenated into file-3, it should be like-
| Code: |
FILE ONE START
000xxxxxxxx
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
100aaaaaaaaaaaaaaa
001xxxxxxxxx
FILE ONE END
FILE TWO START
000xxxxxxxxx
100ddddddddddddddddddddd
100ddddddddddddddddddddd
100ddddddddddddddddddddd
100ddddddddddddddddddddd
001xxxxxxxxx
FILE TWO END
|
The attributes of the file-3 will be record length 400 and type FB.
In all the above three files first 3 bytes will be record type, where if it is
000 - Header
100 - detail record
001 - trailer record
and the text - FILE ONE START, FILE ONE END, FILE TWO START and FILE TWO END added during merge/concatenate in file-3, will be used to process records in different manner and identify easily.
number of records in file-1 and file-2 could be around 100 to 10,000 rows and vary differently each day.
kindly can anyone guide me on the requirement for the solution with ICETOOL. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=file380
//IN2 DD DSN=file400
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(400:X)
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=('FILE ONE START'),
TRAILER1=('FILE ONE END')
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=('FILE TWO START'),
TRAILER1=('FILE TWO END')
/* |
Gerry |
|
| Back to top |
|
 |
Divyananda
New User
Joined: 11 Dec 2008 Posts: 9 Location: Chennai
|
|
|
|
Hi Gerry,
Thanks for reply.
When i tried with the code provided, i am getting the return code 16 and TOOLMSG and DFSmsg ARE A S SHOWN BELOW.
(I tried with FILE-1 record length 387 and type FB, FILE-2 record length 400 and type FB)
TOOLMSG
| Code: |
************************************ TOP OF DATA ***************************************
1ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED
ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES AND MORE
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN
ICE630I 0 MODE IN EFFECT: STOP
COPY FROM(IN1) TO(OUT) USING(CTL1)
ICE606I 0 DFSORT CALL 0001 FOR COPY FROM IN1 TO OUT USING CTL1CNTL TERMINATED
ICE602I 0 OPERATION RETURN CODE: 16
ICE630I 2 MODE IN EFFECT: SCAN
COPY FROM(IN2) TO(OUT) USING(CTL2)
ICE612I 0 NO ERRORS FOUND IN STATEMENT
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16
************************************* BOTTOM OF DATA ************************************
|
and DFSMSG
| Code: |
********************************* TOP OF DATA **********************************
1ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 09:02 ON WED DEC 08, 2010 -
0 INREC OVERLAY=(400:TOOLMSG)
Å
ICE006A 0 OPERAND DEFINER ERROR
OUTFIL FNAMES=OUT,REMOVECC,
HEADER1=('FILE ONE START'),
TRAILER1=('FILE ONE END')
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN1,SO*
RTOUT=OUT,DYNALLOC
SORT FIELDS=COPY
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707
ICE052I 3 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
can you help on this |
|
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Divyananda,
this statement does not match what I provided
| Code: |
| INREC OVERLAY=(400:TOOLMSG) |
Gerry |
|
| Back to top |
|
 |
Divyananda
New User
Joined: 11 Dec 2008 Posts: 9 Location: Chennai
|
|
|
|
Hi Gerry,
Yes you are right, i wrongly used the code, I changed and executed the code.
I could see that the code merges the two files file-1 and file-2 successfully when the target is SYSOUT.
When i tried with file-3 of record length of 400 instead of SYSOUT as the output for merged data, only the contents of file-2 is visible in File-3 as shown below.
| Code: |
FILE TWO START
000FILE2 HEADER
100TRANSACTION1YYYYYYYYYYYYYYYYYYYYYYYY
100TRANSACTION2YYYYYYYYYYYYYYYYYYYYYYYY
100TRANSACTION3YYYYYYYYYYYYYYYYYYYYYYYY
100TRANSACTION4YYYYYYYYYYYYYYYYYYYYYYYY
000800000010344 2010120820101208PROD00000001
001800000000000021F86CCEEFEEF7A575BEE6F7D3636A75C
001FILE2 TRAILER
FILE TWO END
|
the file-1 content is not copied into file-3,
Can you help me again. |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 Location: Welsh Wales
|
|
|
|
| Mmmmmmmmmmmmmmm, and would you have used DISP=MOD for file 3 |
|
| Back to top |
|
 |
Divyananda
New User
Joined: 11 Dec 2008 Posts: 9 Location: Chennai
|
|
|
|
Hi Gerry and Expat,
I used DISP as SHR and tried, now i changed DISP to MOD for file-3 and tried.
It is working .
Thanks for the support |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|