|
View previous topic :: View next topic
|
| Author |
Message |
ramas.kamal
New User

Joined: 03 Mar 2014 Posts: 22 Location: India
|
|
|
|
Hi,
This is my first post in this forum. I will try my best to explain what I really need. We use Syncsort 1.3
I have 3 file (LRECL=80,RECFM=FB) with data as shown below. Here, all sets of records appear in sets (a set contains 01 to 99 at 1st position). I am showing only those records that are present in all three files and want to copy to output.
File-1:
| Code: |
01 AAA..BEGIN
02 AAA..JAN2014
03 AAA..PERIODIC DATA
99 AAA..END
|
File-2:
| Code: |
01 AAA..BEGIN
02 AAA..FEB2014
03 AAA..PERIODIC DATA
04 AAA..CHANGE
07 AAA..CHOICES
99 AAA..END
|
File-3:
| Code: |
01 AAA..BEGIN
02 AAA..MAR2014
03 AAA..PERIODIC DATA
06 AAA..SPECIAL DATA
12 AAA..ERROR DATA
99 AAA..END
|
I tried below SYSIN and got plain output. But, I want to have a 80 char line before first 01 and between each 99 and 01 and after last 99 records.
| Code: |
SORT FIELDS=COPY
INCLUDE COND=(4,3,CH,EQ,C'AAA')
|
I actually expect the output to be as given below and don't know what I should add to my above SYSIN card to get the same.
| Code: |
*****************************
01 AAA..BEGIN
02 AAA..FEB2014
03 AAA..HISTORY
99 AAA..END
*****************************
01 AAA..BEGIN
02 AAA..FEB2014
03 AAA..PERIODIC DATA
04 AAA..CHANGE
07 AAA..CHOICES
99 AAA..END
*****************************
01 AAA..BEGIN
02 AAA..FEB2014
03 AAA..PERIODIC DATA
06 AAA..SPECIAL DATA
12 AAA..ERROR DATA
99 AAA..END
*****************************
|
Can you please help me with the solution. Thanks in advance. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why you'd just expect it to work like that, I don't know.
OUTFIL reporting functions, HEADER1, SECTIONS, TRAILER3. Manual. Examples. |
|
| Back to top |
|
 |
ramas.kamal
New User

Joined: 03 Mar 2014 Posts: 22 Location: India
|
|
|
|
Bill, I tried that Sysin card to start with and did not have an idea how to develop it further to get desired results. I will try your suggestions.
Thanks. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Suggest you use our forum SEARCH (blue line at the top of the page) an d look for the functions Bill mentioned.
There is also a link to IBM Manuals at the top of the page.
If you get stuck, someone will be here. |
|
| Back to top |
|
 |
JAYACHANDRAN THAMPY
New User
Joined: 06 Jun 2006 Posts: 8
|
|
|
|
A solution using OUTFIL IFTHEN.
| Code: |
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOURFILE1,DISP=SHR
// DD DSN=YOURFILE2,DISP=SHR
// DD DSN=YOURFILE3,DISP=SHR
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,5,ZD)
OUTFIL IFTHEN=(WHEN=(81,5,ZD,EQ,1),BUILD=(1:80C'*',/,1,80)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),BUILD=(1,80,/,1:80C'*')),
IFTHEN=(WHEN=NONE,BUILD=(1,80))
SORT FIELDS=COPY
//SORTOUT DD SYSOUT=* |
Output
***********************************************************
01 AAA..BEGIN
02 AAA..JAN2014
03 AAA..PERIODIC DATA
99 AAA..END
***********************************************************
01 AAA..BEGIN
02 AAA..FEB2014
03 AAA..PERIODIC DATA
04 AAA..CHANGE
07 AAA..CHOICES
99 AAA..END
***********************************************************
01 AAA..BEGIN
02 AAA..MAR2014
03 AAA..PERIODIC DATA
06 AAA..SPECIAL DATA
12 AAA..ERROR DATA
99 AAA..END
*********************************************************** |
|
| Back to top |
|
 |
ramas.kamal
New User

Joined: 03 Mar 2014 Posts: 22 Location: India
|
|
|
|
Hi Bill and Dick, thanks for your suggestions.
Hi JAYACHANDRAN THAMPY, thanks a lot for the solution you have provided. I added include condition to your solution to get only desired records.
Thanks all. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|