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
 

 

Sign Leading Sort

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

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Wed May 06, 2009 3:12 pm    Post subject: Sign Leading Sort
Reply with quote

Can you anyone help me ti get the output of this code?

Code:
//STEP01    EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*   
//SORTIN    DD *         
+12AA                     
-05AA                     
//SORTOUT   DD SYSOUT=*   
//SYSIN     DD *         
 SORT FIELDS=(4,2,CH,A)   
 SUM FIELDS=(1,3,PD)     
/*


My expected answer is 7.
Which datatype should I have to use in SUMFIELDS???
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed May 06, 2009 3:22 pm    Post subject:
Reply with quote

FS (floating sign) format
description, C.1
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed May 06, 2009 3:29 pm    Post subject:
Reply with quote

look thru the DFSORT/ICETOOL threads,
recently Frank provided a solution about SUMming leading signed.[/url]
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: Wed May 06, 2009 9:12 pm    Post subject:
Reply with quote

nagarajan.dharani,

You can't use FS format in SUM. You need to do some conversion. Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
+12AA
-05AA
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
 INREC OVERLAY=(81:1,3,FS,TO=PD,LENGTH=2)
 SORT FIELDS=(4,2,CH,A)
 SUM FIELDS=(81,2,PD)
 OUTREC OVERLAY=(1:81,2,PD,EDIT=(STT),SIGNS=(+,-))
/*
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed May 06, 2009 9:12 pm    Post subject:
Reply with quote

nagarajan.dharani,


You opened a similar thread in here

http://ibmmainframes.com/viewtopic.php?t=40320

why cant you just post in the same topic?


Anyway here are two ways for getting the desired results

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
+12AA                                                       
-05AA                                                       
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=(4,2,CH,A),EQUALS                             
  OUTFIL REMOVECC,NODETAIL,                                 
  SECTIONS=(4,2,                                             
  TRAILER3=(1:TOT=(1,3,FS,EDIT=(STT),SIGNS=('+','-')),4,77))
/*   


converting FS to PD format and summing it and converting it back again

Code:
                                                       
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
+12AA                                                       
-05AA                                                       
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  INREC OVERLAY=(1:1,3,FS,PD,LENGTH=3)                     
  SORT FIELDS=(4,2,CH,A),EQUALS                             
  SUM FIELDS=(1,3,PD)                                       
  OUTREC OVERLAY=(1:1,3,PD,EDIT=(STT),SIGNS=('+','-'))       
/*



Cics guy,

Sign leading numbers(FS) cannot be directly used on SUM statement. You need to convert the FS value to PD/ZD, SUM it and convert it back to FS. However, it might be easier to use OUTFIL SECTIONS/TRAILER3/TOT with FS/SFF instead.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed May 06, 2009 9:19 pm    Post subject:
Reply with quote

Skolusu wrote:
Cics guy,

Sign leading numbers(FS) cannot be directly used on SUM statement. You need to convert the FS value to PD/ZD, SUM it and convert it back to FS. However, it might be easier to use OUTFIL SECTIONS/TRAILER3/TOT with FS/SFF instead.
Understood, thanks.

Both you and Frank posted at the same time, what is this, the battle of the Sort Wizards? icon_lol.gif
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: Wed May 06, 2009 9:28 pm    Post subject:
Reply with quote

Just "parallel" posting. Sometimes we discuss who will answer specific posts and sometimes we don't. I'm working at home today so we're not across the aisle from each other as we usually are at the office.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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