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

writing count as well as seq no. using sort


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

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu Feb 07, 2008 8:59 pm
Reply with quote

Hi

i have the following requirement

sample input

AAA
AAA
AAA
BBB
BBB
CCC
DDD

Expected output

AAA 3 1
AAA 3 2
AAA 3 3
BBB 2 1
BBB 2 2
CCC1 1
DDD1 1

Can this be done using sort.
i tried doing with restart keyword. but i could get only 1,2,3 part but i also need 3,3,3 part. can any one help me
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Feb 07, 2008 10:44 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
AAA
AAA
AAA
BBB
BBB
CCC
DDD
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN   DD    *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(IN) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,3,CH) -
  WITHALL WITH(7,1)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
    SECTIONS=(1,3,
      TRAILER3=(1,3,5:COUNT=(EDIT=(T))))
/*
//CTL2CNTL DD *
  INREC OVERLAY=(7:SEQNUM,1,ZD,RESTART=(1,3))
/*
Back to top
View user's profile Send private message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu Feb 07, 2008 11:16 pm
Reply with quote

Thank you frank.. it's working fine for me

but one more addition to requirement. ie. can we do positional sorting (contents at that position is not known). i.e IF content of position 5 and 7 are not same i need to exclude those records. can this be possible using sort.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Feb 07, 2008 11:28 pm
Reply with quote

I don't understand what you're asking for. Please show an example of your input record and expected output records for the situation you're talking about and explain the "rules" for getting from input to output. Give the starting position, length and format for each relevant field. Give the RECFM and LRECL for the input file.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top