|
View previous topic :: View next topic
|
| Author |
Message |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi all,
I have a PS file which has records in it.
The PS file looks like this.
| Code: |
42 000001 B80 0000
42 000001 S80 0000
42 000004 B80 0000
42 000004 S80 0000
42 000007 B80 0000
42 000007 S80 0000
42 000014 B80 0000 |
I have sorted the above PS file based on the second fields.
Now I wanted to insert a line of space in between the similar records.
Like this.
| Code: |
42 000001 B80 0000
42 000001 S80 0000
42 000004 B80 0000
42 000004 S80 0000
42 000007 B80 0000
42 000007 S80 0000
42 000014 B80 0000 |
Could any one explain the process on how to do this ?
Code'd |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| On OUTFIL you can use the / (slash operator) to add additional records into the file. You can use the OUTFIL reporting functions, probably for this just SECTIONS will be enough, but look at HEADERn and TRAILERn at the same time. You'll need REMOVECC. Find out why. |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Do you have group of two records or cannot be defined? |
|
| Back to top |
|
 |
ezio vin
New User

Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
42 000001 B80 0000
42 000001 S80 0000
42 000004 B80 0000
42 000004 S80 0000
42 000007 B80 0000
42 000007 S80 0000
42 000014 B80 0000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL IFTHEN=(WHEN=(11,3,CH,EQ,C'S80'),
BUILD=(1,21,/)) |
SORTOUT Output
| Code: |
42 000001 B80 0000
42 000001 S80 0000
42 000004 B80 0000
42 000004 S80 0000
42 000007 B80 0000
42 000007 S80 0000
42 000014 B80 0000 |
try this |
|
| Back to top |
|
 |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
@ezio vin.
I have executed this. But the first space is inserting after the first record as it satisfies the condition. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
your data must be different than the one you have posted.
The first record is B80 not S80.
Gerry |
|
| Back to top |
|
 |
ezio vin
New User

Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
| what's your input data ?? |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I just realised you have sorted the file on the second field only, hence the 3rd field could be in any order.
try this
| Code: |
SORT FIELDS=(4,6,BI,A)
INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(4,6),PUSH=(81:ID=8,SEQ=8))
OUTFIL IFTHEN=(WHEN=(81,8,ZD,GT,+1,&,
89,8,ZD,EQ,+1),
BUILD=(/,1,80))
|
Gerry |
|
| Back to top |
|
 |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
| @ezio vin I have posted the input data in the question. Please refer it. |
|
| Back to top |
|
 |
ezio vin
New User

Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
i used the same input you gave in the sort input could you please check that in my post
did u change anything in sort card ? |
|
| Back to top |
|
 |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi
@gcicchet,
The space should be inserted based on the second field only. And what you said is right. The 3rd field could be in any order.
Thank you. |
|
| Back to top |
|
 |
|
|