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
 
Storing previous values

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

New User


Joined: 15 Dec 2005
Posts: 21

PostPosted: Mon Oct 19, 2009 9:11 pm    Post subject: Storing previous values
Reply with quote

Input file:

BILL-ACCT ENDPT-IND NET-CHARGE-AMT CSF-ID
-------------------- -------------- ----------------- | -- --------------
330612010, ,Y, , 000000010.00, | ,1HXCH 75F 0002
330612010, ,N, , 000000020.00, | ,1HXCH 75F 0002[/b]
330612011, ,N, , 000000010.00, | ,1HXCH 75F 0003
330612011, ,N, , 000000030.00, | ,1HXCH 75F 0003
330612012, ,Y, , 000000010.00, | ,1HUSF K8F 0001
330612012, ,Y, , 000000030.00, | ,1HUSF K8F 0001

each account has two rows. i want my output in one row of each account.

conditions are
1. NET-CHARGE-AMT - this should be summarized
2. ENDPT-IND - should be splitted into two fields ENDPT-INDA & ENDPT-INDB in a single row.

OUTPUT
BILL-ACCT ENDPT-INDA ENDPT-INDB NET-CHARGE-AMT
330612010 Y N 30
330612011 N N 40
330612012 Y Y 40

Is it possible in SORT? Is it possible to store the retrieve the previous value in sort?
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Oct 19, 2009 9:38 pm    Post subject: Reply to: Storing previous values
Reply with quote

vijayprabu,

why are you ignoring the decimals? Here is a DFSORT JCL which will give you the desired results

Code:

//STEP0010 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+--
330612010, ,Y, , 000000010.00, | ,1HXCH 75F 0002                   
330612010, ,N, , 000000020.00, | ,1HXCH 75F 0002                   
330612011, ,N, , 000000010.00, | ,1HXCH 75F 0003                   
330612011, ,N, , 000000030.00, | ,1HXCH 75F 0003                   
330612012, ,Y, , 000000010.00, | ,1HUSF K8F 0001                   
330612012, ,Y, , 000000030.00, | ,1HUSF K8F 0001                   
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=(1,9,CH,A)                                           
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(82:SEQNUM,8,ZD,RESTART=(1,9))),
  IFTHEN=(WHEN=GROUP,BEGIN=(82,8,ZD,EQ,1),PUSH=(81:13,1))         
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                           
  SECTIONS=(1,9,TRAILER3=(1,9,C',',13,1,C',',81,1,C',',           
            TOT=(17,13,UFF,EDIT=(TTTTTTTTTT.TT))))                 
/*


The output from this job is

Code:

330612010,N,Y,0000000030.00
330612011,N,N,0000000040.00
330612012,Y,Y,0000000040.00
Back to top
View user's profile Send private message
vijayprabu

New User


Joined: 15 Dec 2005
Posts: 21

PostPosted: Tue Oct 20, 2009 12:11 am    Post subject:
Reply with quote

Thank you so much for your reply, i have been trying based on your sample sort.

But the push values is not getting inserted in out put,

Input rec length is 2742

my sort control card is
SORT FIELDS=(60,20,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,RESTART=(60,20))),
IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:328,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(2751X),
SECTIONS=(60,20,TRAILER3=(1,59,60,20,80,247,2743,1,328,1,329,67,
TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),2743,1))

I want the same input file structure and along with that i want to insert the PUSH position into 2743,1 but it is not actually inserting

Please let me know if you have any idea on this.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 20, 2009 1:11 am    Post subject:
Reply with quote

vijayprabu,

Unless the input file is VB , I don't see any problem with the control cards. If the input is a VB file you need to do it a little differently. Show me the sysout you got from the above job and I will show you a way to do it?
Back to top
View user's profile Send private message
vijayprabu

New User


Joined: 15 Dec 2005
Posts: 21

PostPosted: Tue Oct 20, 2009 2:49 am    Post subject:
Reply with quote

Kolusu
My control card

//SYSIN DD *
SORT FIELDS=(60,20,CH,A,121,20,CH,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,
RESTART=(121,20))),
IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:329,1))
OUTFIL REMOVECC,NODETAIL,BUILD=(2751X),
SECTIONS=(121,20,TRAILER3=(1,249,250,12,262,66,2743,1,329, 1,330,66, TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),529,4, 533,100,633,4,637,26,663,136))
/*
//*--------------------------------------------------------------------


This is working fine
But i am having some minor issue.

I want to use combination of two key as a unique queue,
i am using 60,20,CH,A,121,20,CH,A to SORT

the same combination key can i use in RESTART and SECTION column?

60, 20 - account number
121, 20 - circuit id

i cant use either one as a key field

and again THANK U SO MUCH FOR YOUR HELP
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 20, 2009 10:35 pm    Post subject:
Reply with quote

vijayprabhu,

If you have a combination of fields as a key , then you first need to put them together at the end and use the RESTART parm. Here are the updated control cards for that

Code:

//SYSIN    DD *                                                   
 SORT FIELDS=(60,20,CH,A,121,20,CH,A)                             
 OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2752:60,20,121,20)),           
 IFTHEN=(WHEN=INIT,OVERLAY=(2744:SEQNUM,8,ZD,RESTART=(2752,40))), 
 IFTHEN=(WHEN=GROUP,BEGIN=(2744,8,ZD,EQ,1),PUSH=(2743:328,1))     
 OUTFIL REMOVECC,NODETAIL,BUILD=(2742X),                           
 SECTIONS=(60,20,121,20,
 TRAILER3=(1,59,60,20,80,247,2743,1,328,1,329,67, 
 TOT=(396,13,UFF,EDIT=(TTTTTTTTTT.TT)),2743,1))                   
/*
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 it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm

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