View previous topic :: View next topic
|
Author |
Message |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Thanks for the reply....
Problem got resolved using Arun's solution....
Thank you..... |
|
Back to top |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
A small doubt..
OUTFIL BUILD=(1,80,/,80C'-')
In this what does the '/' signify ??........
(1 is start pos,80 is length) |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You're welcome. '/' stands for a single line break. It will take you to the next line. |
|
Back to top |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Thanks once again Arun..... |
|
Back to top |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
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 |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Added to the above.....
If i want write a line after every two records then how to proceed...
Please suggest ..... |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
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 |
|
|
ssmukul
New User
Joined: 22 Jan 2008 Posts: 19 Location: India
|
|
|
|
Hi Naresh,
It overlays 8 byte ID character at position 81 that increments by 1 for each group.
Thanks |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|