Aravinth Kumar
New User
Joined: 20 May 2022 Posts: 6 Location: India
|
|
|
|
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!! |
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1329 Location: Bamberg, Germany
|
|
|
|
Topic is neither JCL, nor VSAM related.
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 ************* |
|
|