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

Write line after every record using SORT


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

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 1:49 pm
Reply with quote

Am having 10 records in input file. The requirment is need to write a line after copying every record. Need to get the output as mentioned below..
This should be done in SORT only..... Can anyone one suggest me how to proceed further.....

INPUT:
ABCDE PQRST ABCDE
PQRST EFGHI ABCDE

OUTPUT:

ABCDE PQRST ABCDE
--------------------------
PQRST EFGHI ABCDE
-------------------------
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Aug 02, 2010 4:02 pm
Reply with quote

Naresh,

I assumed an FB dataset of LRECL=80. Modify it as per your attributes.
Code:
//SYSIN DD *
  SORT FIELDS=COPY               
  OUTFIL BUILD=(1,80,/,80C'-')       
/*
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 4:13 pm
Reply with quote

Thanks for the reply....
Problem got resolved using Arun's solution....
Thank you.....
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 4:16 pm
Reply with quote

A small doubt..
OUTFIL BUILD=(1,80,/,80C'-')
In this what does the '/' signify ??........
(1 is start pos,80 is length)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Aug 02, 2010 4:32 pm
Reply with quote

You're welcome. '/' stands for a single line break. It will take you to the next line.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 4:40 pm
Reply with quote

Thanks once again Arun.....
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 5:56 pm
Reply with quote

If i want write two lines after every record then how to proceed...
I tried with this.....
SORT FIELDS=COPY
OUTFIL BUILD=(1,80,2/,80C'-')
But am getting a line after 2 lines (one blank record + one line)...
Any suggestions......
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 02, 2010 6:06 pm
Reply with quote

Added to the above.....

If i want write a line after every two records then how to proceed...
Please suggest .....
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Aug 02, 2010 10:21 pm
Reply with quote

nareshdacha wrote:
Added to the above.....

If i want write a line after every two records then how to proceed...
Please suggest .....


nareshdacha,

The following DFSORT JCL will give you the desired results

Code:
         
//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
LINE-1                                                 
LINE-2                                                 
LINE-3                                                 
LINE-4                                                 
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:ID=8))   
  OUTFIL REMOVECC,BUILD=(1,80),                         
  SECTIONS=(81,8,TRAILER3=(80C'-'))                     
//*


the output of this is

Code:

LINE-1                               
LINE-2                               
--------------------------------------
LINE-3                               
LINE-4                               
--------------------------------------
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 03, 2010 10:36 am
Reply with quote

Quote:
If i want write two lines after every record then how to proceed
For this requirement you might want to try this
Code:
//SYSIN DD *
  SORT FIELDS=COPY               
  OUTFIL BUILD=(1,80,/,80C'-',/,80C'-')       
/*
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Aug 09, 2010 12:54 pm
Reply with quote

Thanks Arun...
I know that REMOVECC is to remove the ASCII char which will append in the first..

Could you please tell what does the PUSH=(81:ID=8)) means....
Back to top
View user's profile Send private message
ssmukul

New User


Joined: 22 Jan 2008
Posts: 19
Location: India

PostPosted: Mon Aug 09, 2010 1:45 pm
Reply with quote

Hi Naresh,

It overlays 8 byte ID character at position 81 that increments by 1 for each group.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 09, 2010 11:24 pm
Reply with quote

Quote:
Could you please tell what does the PUSH=(81:ID=8)) means....


For complete details on DFSORT's GROUP function, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000085
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 Copy only TEXT or String from a record SYNCSORT 4
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top