|
View previous topic :: View next topic
|
| Author |
Message |
Thiru S
New User
Joined: 21 Aug 2019 Posts: 1 Location: India
|
|
|
|
Hi,
I want to concatenate two files in to a single file. File does not have any key but both have same number of records. only problem is the record length varies.
For example,
File 1: - FB, LRECL=8
12345678
123456
1234567
123456
File 2: - FB, LRECL = 10
ABCDEFGH
ABCDEFGHIJ
ABCDEFG
ABCDEF
Output should be: (LRECL =18)
12345678ABCDEFGH
123456ABCDEFGHIJ
1234567ABCDEFG
123456ABCDEF
I have seen some examples of using ICETOOl and SLICE functions, but all having same fixed record length in the file.
If Someone help on this scenario it would be grateful. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2288 Location: USA
|
|
|
|
| Thiru S wrote: |
| I want to concatenate two files in to a single file. File does not have any key but both have same number of records. only problem is the record length varies. |
1) In your example the record length is fixed for each of files. Nothing varies.
2) Your task is the most primitive task described with tons of examples in multiple guides, and manuals. Did you read any? |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2288 Location: USA
|
|
|
|
| Code: |
//*===========================================================
//*
// SET DEBUG='SYSOUT=*'
//*SET DEBUG=DUMMY
// SET LOG='SYSOUT=*'
//*SET LOG=DUMMY
//*
//*===========================================================
//CONSQUIZ EXEC PGM=SYNCTOOL
//*
//SORTF1 DD *
12345678
123456
1234567
123456
//SORTF2 DD *
ABCDEFGH
ABCDEFGHIJ
ABCDEFG
ABCDEF
//*
//TOOLMSG DD &DEBUG
//SSMSG DD &DEBUG
//*
//*
//SEQ1@ DD &LOG
//SEQ1 DD UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)
//SEQ2@ DD &LOG
//SEQ2 DD UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)
//REPORT DD &LOG
//OUTPUT DD DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),
// DSN=&&OUTPUT
//*
//TOOLIN DD *
COPY FROM(SORTF1) TO(SEQ1,SEQ1@) USING(S001)
COPY FROM(SORTF2) TO(SEQ2,SEQ2@) USING(S002)
COPY JKFROM TO(REPORT,OUTPUT) USING(S003)
//*
//S001CNTL DD *
INREC BUILD=(SEQNUM,4,BI,1,8)
//*
//S002CNTL DD *
INREC BUILD=(SEQNUM,4,BI,1,10)
//*
//S003CNTL DD *
JOINKEYS F1=SEQ1,
FIELDS=(1,4,A),
SORTED
JOINKEYS F2=SEQ2,
FIELDS=(1,4,A),
SORTED
REFORMAT FIELDS=(F1:5,8,
F2:5,10)
INREC BUILD=(1,18,SQZ=(SHIFT=LEFT))
//* |
| Code: |
********************************* TOP OF DATA *******
12345678ABCDEFGH
123456ABCDEFGHIJ
1234567ABCDEFG
123456ABCDEF
******************************** BOTTOM OF DATA ***** |
| Quote: |
“The method employed I would gladly explain,
While I have it so clear in my head,
If I had but the time and you had but the brain—
But much yet remains to be said. |
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
Please use the code tags while representing the code/data.
| Quote: |
| I have seen some examples of using ICETOOl and SLICE functions, but all having same fixed record length in the file. |
It is actually SPLICE.
Join fields from two files record-by-record
Look at the two methods and code provided on page-17, Bookmark this for any such DFSORT tricks required for you in future. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|