IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Addition of packed decimal using SORT jcl


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Tue Nov 20, 2007 11:28 am
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
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Nov 20, 2007 9:38 pm
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:

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:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top