Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

writing count as well as seq no. using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: writing count as well as seq no. using sort
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 Moderator


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

PostPosted: Thu Feb 07, 2008 10:44 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Feb 07, 2008 11:28 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us