Team,
I am trying to add the trailer record to build TRL and date and time in the output DYNAMIC sort card but getting lot of errors. could anyone please help on this
I have the input file as like below
xxxxxxxx 20200412101223
yyyyyyyy 20200312101128
Sort card to prepare a dynamic Sort card
SYSIN DD *
OPTION COPY
INCLUDE COND=(1,8,CH,EQ,C'XXXXXXXX')
OUTFIL REMOVECC,
HEADER1=('SORT FIELDS=(57,8,ZD,D)'),
BUILD=(C' INCLUDE COND=((57,8,ZD,GT,',9,8,C'),OR,',40X,/,
C' (57,8,ZD,EQ,',9,8,C',AND,65,6,ZD,GT,',17,6,C')),
C('TRAILER1=('TRL',DATE=(4MD/),TIME=(24)))')
output what i expect
SORT FIELDS(57,8,ZD,D)
INCLUDE COND=((57,8,ZD,GT,20200421), OR,
(57,8,ZD,EQ,20200421,AND,65,6,ZD,GT,101223))
TRAILER1=('TRL',DATE=(4MD/),TIME=(24))
EXCEPT THE TRAILER, ITS WORKING FINE. TRAILER IS GIVING LOT OF SYNTAX ERRORS IN THE TRAILER LINE RC 0008
Thanks in Advance
Mainframe - Dynamic sort card building with trailer record
-
- Posts: 7
- Joined: Thu May 15, 2014 4:46 pm
- Skillset: Cobol, JCL, DB2, VSAM
- Referer: Website
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Mainframe - Dynamic sort card building with trailer reco
RTFM:
TRAILERx=(field1,field2,...,fieldn)
&DATE[±nnnn]
&DATE=(m1m2m3m4)[±nnnn]
&DATENS=(xyz)[±nnnn]
&YDDD=(m1m2m3)[±nnnn]
&YDDDNS=(m1m2)[±nnnn]
Javas and Pythons come and go, but JCL and SORT stay forever.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Mainframe - Dynamic sort card building with trailer reco
Dambaattam wrote:TRAILER IS GIVING LOT OF SYNTAX ERRORS IN THE TRAILER LINE RC 0008
WTF???
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Mainframe - Dynamic sort card building with trailer reco
1 - use the code tags to present your code. As it is posted your control statements start in cc1 which is reserved for labels and your data has spaces but have those spaces been truncated by HTML?
2 - Show your sort messages
3 - get rid of those capitals.
4 - SYSIN DD * is a JCL statement not a sort control statement and as such should begin //
2 - Show your sort messages
3 - get rid of those capitals.
4 - SYSIN DD * is a JCL statement not a sort control statement and as such should begin //
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Posts: 7
- Joined: Thu May 15, 2014 4:46 pm
- Skillset: Cobol, JCL, DB2, VSAM
- Referer: Website
Re: Mainframe - Dynamic sort card building with trailer reco
It worked with sort card shown below
Output obtained
Coded for you DO IT YOURSELF IN FUTURE
Code: Select all
OPTION COPY
INCLUDE COND=(1,8,CH,EQ,C'XXXXXXXX')
OUTFIL REMOVECC,
HEADER1=('SORT FIELDS=(57,8,ZD,D)',/,
' INCLUDE COND=((57,8,ZD,GT,',9,8,C'),OR,'),
Build=(C' (57,8,ZD,EQ,',9,8,C',AND,65,6,ZD,GT,',17,6,C'))',80:x),
TRAILER1=(C' OUTFIL,REMOVECC,',/,
''TRAILER1=(C''TRL'',DATE=(4MD/),TIME)',80:X))
Output obtained
Code: Select all
SORT FIELDS(57,8,ZD,D)
INCLUDE COND=((57,8,ZD,GT,20200421), OR,
(57,8,ZD,EQ,20200421,AND,65,6,ZD,GT,101223))
OUTFIL REMOVECC,
TRAILER1=('TRL',DATE=(4MD/),TIME)
Coded for you DO IT YOURSELF IN FUTURE
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Mainframe - Dynamic sort card building with trailer reco
That will not work - your control statements must start in column 2, or later. As you can see from the coded statements you have them starting in column 1.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Mainframe - Dynamic sort card building with trailer reco
Discussions with newcomers at this forum do more and more resemble a conversation between a blind person, and a deaf one...
It's getting much easier just to give a ready solution rather than trying for weeks, and for months, to give lessons for those who has no intention to learn it or to try it, at all.

It's getting much easier just to give a ready solution rather than trying for weeks, and for months, to give lessons for those who has no intention to learn it or to try it, at all.
Code: Select all
//*=====================================================================
//* PROCESS DYNAMIC DATES
//*=====================================================================
//SYMDATES EXEC PGM=SYNCSORT
//*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD *
XXXXXXXX 20200412101223
YYYYYYYY 20200312101128
ZZZZZZZZ 20200212101128
//*
//SYMBOLS@ DD SYSOUT=*
//SYMBOLS DD DISP=(NEW,PASS),
// DCB=(RECFM=FB,LRECL=80),
// UNIT=SYSDA,SPACE=(TRK,(5,5),RLSE),
// DSN=&&SYMNAMES
//*
//SYSIN DD *
INCLUDE COND=(1,8,CH,EQ,C'XXXXXXXX')
SORT FIELDS=COPY,STOPAFT=1
OUTFIL FNAMES=(SYMBOLS,SYMBOLS@),NULLOFL=RC4,
BUILD=(C'VALID_DATE1,C''',10,8,C'''',80:X,
/,C'VALID_DATE2,C''',18,6,C'''',80:X)
END
//*
//*
//*=====================================================================
//SELECT EXEC PGM=SYNCSORT,COND=(0,NE,SYMDATES)
//*
//SYMNAMES DD DISP=(OLD,DELETE),DSN=&&SYMNAMES
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD *
AAAAAAAA 20200412101223
BBBBBBBB 20200412101228
CCCCCCCC 20200512101123
DDDDDDDD 20200612101122
TTTTTTTT 20200412101223
UUUUUUUU 20200412101220
VVVVVVVV 20200512101120
WWWWWWWW 20200612101120
//*
//SORTOUT DD SYSOUT=*
//*
//SYSIN DD *
INCLUDE COND=((57,8,CH,GT,VALID_DATE1),
OR,(57,8,CH,EQ,VALID_DATE1,
AND,65,6,CH,GT,VALID_DATE2))
SORT FIELDS(57,8,CH,D)
OUTFIL REMOVECC,
TRAILER1=('TRL ',&DATE(4MD/),X,&TIME)
END
//*
//*
//*=====================================================================
Code: Select all
********************************* TOP OF DATA *****************************
DDDDDDDD 20200612101122
WWWWWWWW 20200612101120
CCCCCCCC 20200512101123
VVVVVVVV 20200512101120
BBBBBBBB 20200412101228
TRL 2020/04/23 09:14:39
******************************** BOTTOM OF DATA ***************************
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1
- 1936
-
by NicC
View the latest post
Sun Sep 06, 2020 5:10 pm
-
-
SORT to add trailer record on change of key + Date
by Prashant_2021 » Fri Aug 27, 2021 11:04 pm » in DFSORT/ICETOOL/ICEGENER - 1
- 1666
-
by sergeyken
View the latest post
Sat Aug 28, 2021 11:15 pm
-
-
-
Parsing more than 1000 columns in a sort card Reply with quo
by ssuthagar » Tue Sep 22, 2020 3:02 am » in Syncsort/Synctool - 1
- 3437
-
by sergeyken
View the latest post
Tue Sep 22, 2020 9:06 pm
-
-
-
sort card to add zeros to varying alphanumeric field.
by longfall » Thu Mar 09, 2023 12:03 am » in DFSORT/ICETOOL/ICEGENER - 1
- 1821
-
by sergeyken
View the latest post
Thu Mar 09, 2023 2:04 am
-
-
-
Copy partial record after a string in a record using SORT.
by Esmayeelhusen » Thu May 04, 2023 3:03 pm » in DFSORT/ICETOOL/ICEGENER - 16
- 4146
-
by Esmayeelhusen
View the latest post
Mon May 22, 2023 3:50 pm
-