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

Adding a trailer with record count and sum of the amount


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aravinth Kumar

New User


Joined: 20 May 2022
Posts: 6
Location: India

PostPosted: Wed Jul 20, 2022 9:08 pm
Reply with quote

Hello Guys,
I have a requirement to add a trailer record to output file that should contain total input record count and sum of the amount field. Can you please help me with JCL sort syntax for my scenario. If this topic is already discussed then I'm sorry, but please help me with the topic's link.

Attached the snapshot of input and expected output files.
Thanks!!
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 420
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Wed Jul 20, 2022 10:11 pm
Reply with quote

don't use attachments; copy paste screen text and use CODE tags

try

www.ibm.com/support/pages/sites/default/files/inline-files/$FILE/sorttrck.pdf
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Wed Jul 20, 2022 10:46 pm
Reply with quote

Topic is neither JCL, nor VSAM related. icon_rolleyes.gif

Sample:
Code:
//WHATEVER EXEC PGM=ICEMAN                                             
//SORTIN   DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
001 ..        5,395.09-                                                 
002 ..        2,927.98-                                                 
003 ..          597.29                                                 
004 ..          273.28                                                 
005 ..          416.68-                                                 
006 ..        2,898.57                                                 
007 ..        3,549.96-                                                 
008 ..          395.09-                                                 
009 ..        2,405.06                                                 
009 ..        1,103.99-                                                 
/*                                                                     
//SYSOUT   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  OUTFIL FNAMES=(SORTOUT),                                             
    REMOVECC,                                                           
    TRAILER1=(C'Trailer Record ',COUNT+1=(M11,LENGTH=9),               
              TOT=(9,15,SFF,EDIT=(TTTTTTTTTTTT.TTS),SIGNS=(,,,-)))     
  END                                                                   
/*

Output:
Code:
****** **************************** Datenanfang ***********
000001 001 ..        5,395.09-                             
000002 002 ..        2,927.98-                             
000003 003 ..          597.29                             
000004 004 ..          273.28                             
000005 005 ..          416.68-                             
000006 006 ..        2,898.57                             
000007 007 ..        3,549.96-                             
000008 008 ..          395.09-                             
000009 009 ..        2,405.06                             
000010 009 ..        1,103.99-                             
000011 Trailer Record 000000011000000007614.59-           
****** **************************** Datenende *************
Back to top
View user's profile Send private message
Aravinth Kumar

New User


Joined: 20 May 2022
Posts: 6
Location: India

PostPosted: Wed Jul 20, 2022 10:51 pm
Reply with quote

Thank you!!

Let me try it out.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2135
Location: USA

PostPosted: Thu Jul 21, 2022 12:29 am
Reply with quote

Aravinth Kumar wrote:
Thank you!!

Let me try it out.

Please explain: why 10 input records numbered from 1 to 9 should be reported as total count of 11? icon_eek.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts Sort based on the record type DFSORT/ICETOOL 1
Search our Forums:

Back to Top