|
View previous topic :: View next topic
|
| Author |
Message |
shankarparab80
New User
Joined: 22 Mar 2012 Posts: 4 Location: Pune
|
|
|
|
Hi all,
The input file is as follows,
| Code: |
PGM Name | Active / Obsolete
PGM1 Active
PGM1 Active
PGM1 Obsolete
PGM1 Obsolete
PGM2 Active
PGM2 Active
PGM2 Active
PGM2 Obsolete |
In the output file, we need the count of Active & Obsolete for each program,
| Code: |
Pgm Name | Active Count | Obsolete Count
PGM1 2 2
PGM2 3 1 |
We can assume that the input file is FB with record length of 80 and sorted on Program Name.
I have managed to get count of Active or Obsolete separately with 2-3 SORT steps, but just wanted to know if this is possible in lesser no. of steps or single step?
Many thanks.
Shankar |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
This might get you started.
| Code: |
//SECTCT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(16,8,CH,EQ,C'ACTIVE '),
OVERLAY=(20:C'1',30:C'0')),
IFTHEN=(WHEN=(16,8,CH,EQ,C'OBSOLETE'),
OVERLAY=(20:C'0',30:C'1')),
IFTHEN=(WHEN=NONE,
OVERLAY=(20:C'0',30:C'0'))
OUTFIL REMOVECC,NODETAIL,
OMIT=(1,8,CH,EQ,C'PGM NAME'),
HEADER1=('PGM NAME | ','ACTIVE COUNT | ','OBSOLETE COUNT'),
SECTIONS=(1,8,
TRAILER3=(1,8,TOTAL=(20,1,ZD,M10,LENGTH(15)),
TOTAL=(35,1,ZD,M10,LENGTH(15))))
//*
//SORTIN DD *
PGM NAME | ACTIVE / OBSOLETE
PGM1 ACTIVE
PGM1 ACTIVE
PGM1 OBSOLETE
PGM1 OBSOLETE
PGM2 ACTIVE
PGM2 ACTIVE
PGM2 ACTIVE
PGM2 OBSOLETE |
Output:
| Code: |
PGM NAME | ACTIVE COUNT | OBSOLETE COUNT
PGM1 2 2
PGM2 3 1 |
|
|
| Back to top |
|
 |
shankarparab80
New User
Joined: 22 Mar 2012 Posts: 4 Location: Pune
|
|
|
|
Thanks a lot Bill, it is working.
The only change required was position for Online Count, it should have been 30 instead of 35.
TOTAL=(30,1,ZD,M10,LENGTH(15))))
But rest, it is working absolutely correct. Thanks once again. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Glad you have it working. Sorry about the 35/30. I started to try to get the line-up done, then thought "what the heck" and forgot to UNDO before copying. Then missed that when fixing-up after the "paste". No time saved at all in the end :-) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|