Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort-Write a line before 01, between 01 and 99 and after 99
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Mar 10, 2014 9:13 pm    Post subject: Reply to: Sort-Write a line before 01, between 01 and 99 and
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    Post subject: Write a line before 01, between 01 and 99 and after 99
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

Site Director


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

PostPosted: Tue Mar 11, 2014 9:52 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Sort-Write a line before 01, between 01 and 99 and
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us