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

Need SORT Card to reformat the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shankarparab80

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Wed Apr 04, 2012 12:02 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2012 12:47 pm
Reply with quote

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
View user's profile Send private message
shankarparab80

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Wed Apr 04, 2012 2:15 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 04, 2012 2:23 pm
Reply with quote

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
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top