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
 

 

Addition of packed decimal using SORT jcl

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

New User


Joined: 17 Sep 2007
Posts: 68
Location: Kochi

PostPosted: Tue Nov 20, 2007 9:30 am    Post subject: Addition of packed decimal using SORT jcl
Reply with quote

Hi,

I have two input files with s9(11)v9999 COMP-3 variables.
I have to sum up both the numbers are write it to the SORT out file.

Record format: FB
Record length: 80

Both the numbers are at the first postion in both the files.

Please let me know how to do this using JCL sort.

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

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Nov 20, 2007 11:28 am    Post subject: Reply to: Addition of packed decimal using SORT jcl
Reply with quote

rosmi,

Quote:
Please let me know how to do this using JCL sort.


You can use DFSORT for your requirement. DFSORT has many ways to edit a PD field using the edit masks available (M0 - M26).

First convert the PD fields to the required format and then do the arithmetic operation on that.
Back to top
View user's profile Send private message
rosmi joseph

New User


Joined: 17 Sep 2007
Posts: 68
Location: Kochi

PostPosted: Tue Nov 20, 2007 11:37 am    Post subject:
Reply with quote

Hi,

I am not sure abt the syntax. Could anyone please assist me.

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Nov 20, 2007 4:08 pm    Post subject:
Reply with quote

rosmi joseph

SORT JCL for your requirement is as follows
Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD I/P-FILE-1 (FB/80)                         
//         DD I/P-FILE-2 (FB/80)                         
//SORTOUT  DD O/P-FILE (FB/80)                           
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTFIL REMOVECC,NODETAIL,                             
         TRAILER1=(1:TOT=(1,8,PD,TO=PD))                 
/*                                                       


If you want the i/p file records in your o/p then remove NODETAIL from the OUTFIL statement.
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 Nov 20, 2007 9:38 pm    Post subject:
Reply with quote

rosmi joseph,

Note that Krisprems DFSORT job will produce an 8-byte PD total. If you want the total in a displayable form you can use DFSORT edit masks, e.g.

TRAILER1=(TOT=(1,8,PD,M10))

would give you a 15-digit total with leading zeros suppressed, e,g.

Code:

         112344


For more information on using DFSORT edit masks, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.8?DT=20060615173822

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
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