IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort-Write a line before 01, between 01 and 99 and after 99


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramas.kamal

New User


Joined: 03 Mar 2014
Posts: 22
Location: India

PostPosted: Mon Mar 10, 2014 8:58 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 10, 2014 9:13 pm
Reply with quote

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
View user's profile Send private message
ramas.kamal

New User


Joined: 03 Mar 2014
Posts: 22
Location: India

PostPosted: Tue Mar 11, 2014 8:06 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 11, 2014 9:52 pm
Reply with quote

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
View user's profile Send private message
JAYACHANDRAN THAMPY

New User


Joined: 06 Jun 2006
Posts: 8

PostPosted: Wed Mar 12, 2014 12:21 am
Reply with quote

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
View user's profile Send private message
ramas.kamal

New User


Joined: 03 Mar 2014
Posts: 22
Location: India

PostPosted: Wed Mar 12, 2014 10:16 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top