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
 

 

Write line after every record using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Write line after every record using SORT
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: 2171
Location: @my desk

PostPosted: Mon Aug 02, 2010 4:02 pm    Post subject:
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    Post subject: Reply to: Write line after every record using SORT
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    Post subject: Reply to: Write line after every record using SORT
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: 2171
Location: @my desk

PostPosted: Mon Aug 02, 2010 4:32 pm    Post subject:
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    Post subject: Reply to: Write line after every record using SORT
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    Post subject: Reply to: Write line after every record using SORT
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    Post subject: Reply to: Write line after every record using SORT
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    Post subject: Re: Reply to: Write line after every record using SORT
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: 2171
Location: @my desk

PostPosted: Tue Aug 03, 2010 10:36 am    Post subject:
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    Post subject: Reply to: Write line after every record using SORT
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    Post subject:
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 Moderator


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

PostPosted: Mon Aug 09, 2010 11:24 pm    Post subject:
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:

http://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    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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 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


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