Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts Creation of Datasets dynamically on t... Raghu M N DFSORT/ICETOOL 8 Fri Mar 16, 2018 12:56 am
No new posts How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us