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
 

 

need SORT card for writing incrementing seq on condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Nagesh D

New User


Joined: 07 Apr 2011
Posts: 3
Location: Hyd, India

PostPosted: Tue Sep 13, 2011 4:49 pm    Post subject: need SORT card for writing incrementing seq on condition
Reply with quote

Hi,

Require a SORT card for below requirement, preferrably a single card.

Input:
A
B
C
A
C
A
A

Output:
A 01
B 01
C 01
A 02
C 02
A 03
A 04

the sequence number should increment only when the first char is 'A', and the same sequence should be continued with the next records until it finds an 'A' where it gets incremented.

The SORT card which I tried for this requirment.

SORT FIELDS=COPY
OUTREC IFOUTLEN=80,
OUTREC IFOUTLEN=80,
IFTHEN(WHEN=INIT,BUILD=(1,80)),
IFTHEN(WHEN=(1,1,CH,EQ,C'A'),OVERLAY= (51:SEQNUM,8,ZD,START=1))

The above card is incrementing the sequence only when it finds A, but could not build the logic to copy that sequence to the next records with first char other than A.

The above SORT cards output looks like

A 00000001
B
C
A 00000002
C
A 00000003
A 00000004

Thanks.
Back to top
View user's profile Send private message

THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Tue Sep 13, 2011 6:18 pm    Post subject:
Reply with quote

this can be achieved by When=Group.

Code:


//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTREC IFTHEN(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'A'),PUSH=(3:SEQ=2))
 
Back to top
View user's profile Send private message
Nagesh D

New User


Joined: 07 Apr 2011
Posts: 3
Location: Hyd, India

PostPosted: Tue Sep 13, 2011 8:06 pm    Post subject: Reply to: need SORT card for writing incrementing seq on con
Reply with quote

thanks THINKSRINII,

it worked.. tried understanding your SORT card, where I felt BEGIN and PUSH as new terms.

From the IBM manuals I got what BEGIN does, but could not get a clear idea of PUSH.

The below is from manual:

"A BEGIN=(logexp) or END=(logexp) parameter is satisfied when the
| logical expression evaluates as true. You define how the records in a
| group are to be changed using the PUSH parameter"

Could some one add on what exaclty PUSH does, and what all we can do with PUSH.

thanks
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Tue Sep 13, 2011 9:33 pm    Post subject:
Reply with quote

Hi Nagesh,

When=Group is to handle a group of records.
Records are grouped together based on conditions given in Begin or End.
Push is used to push data to all the records that are grouped together.

It is just an equivalent to Build.. It will build the same to all the grouped records.

Let me know if this clarifies your doubt.
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: Tue Sep 13, 2011 11:05 pm    Post subject:
Reply with quote

Quote:
It is just an equivalent to Build.. It will build the same to all the grouped records.


Actually, PUSH is more like OVERLAY than BUILD. It will only PUSH fields from the first record of the group to the indicated positions of the other records of the group. It will NOT affect positions not specified in PUSH.

For example, PUSH=(11:SEQ=2) would overlay positions 11-12 with a sequence number, but not affect positions 1-10 or 13-n.
Back to top
View user's profile Send private message
Nagesh D

New User


Joined: 07 Apr 2011
Posts: 3
Location: Hyd, India

PostPosted: Wed Sep 14, 2011 8:04 pm    Post subject: Reply to: need SORT card for writing incrementing seq on con
Reply with quote

Thanks THINKSRINII..

Thanks Frank...

We can close this topic as the query is answered..and thanks all for the quick update
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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