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

Sorting date into YYYYMMDD, and creating file with date name


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 12:48 pm
Reply with quote

Hello Everyone

my requirement is: first part of the requirement
I need to sort out date from a file1 that contain date part at column 57th see below:
Command ===>
Code:
 =COLS> +----5----+----6----+-
 ****** **********************
 000001             15-JAN-26
 ****** **********************

I want to extract this date in YYYYMMDD format my output file should look like below only containing date part from 1st columns.
output:20260115

second part of the requirement.

Now once i have this date part i have one ftp step in my job which is sending some data to unix server and using below sort card in ftp step:
sort card in ftp step:

Code:
 000001  odstrig Dscof#Tr1g#2k26                                           
 000002  mode stream                                                       
 000003  type binary                                                       
 000004  cd /dsap/home/dspaprep/ETL/rundatefiles                           
 000005  delete TSYS_clndr_event_081023.txt                                 
 000006  put 'ALT0.TSYS.BATCH.STATS.RUNDATE(0)' TSYS_clndr_event_081023.txt
 000007  quit 


I want to update this sort card in run time each time the job runs if you observe the sort card we have one file here TSYS_clndr_event_081023.txt
here i want to replace the 08102 with the date that we have extracted in above step 20260115.txt in line number 5 and 6 both places we are using this file to send it to unix server. I just want to change the file name according to the date that we are fetching in first step.

I am able to achieve the first part of the requirement but i have multiple steps just to extract the date part and convert it into YYYYMMDD format i want to optimize that first part of the requirement and second part i am struggling.

any guidence would be appreciated here.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jan 28, 2026 1:29 pm
Reply with quote

What have you tried yourself?
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 1:37 pm
Reply with quote

I am able to achive the first part of the requirement I am able to extract the date and convert it into YYYYMMDD format but i used multiple steps to achive that like first sorting date part only then convert month part into number and then convert the entire date into YYYYMMDD format but now i am stuck at changing the content ftp sort card at run time it should take the date part and file name should contain that date.txt. Any idea or hint i would try to achive that too.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jan 28, 2026 3:20 pm
Reply with quote

Code:
//WHATEVER EXEC PGM=ICEMAN                                           
//SORTIN   DD *                                                     
                                                        15-JAN-26   
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OPTION COPY,VLSCMP                                                 
  DEBUG ABEND,NOESTAE                                               
  INREC IFTHEN=(WHEN=INIT,                                           
    OVERLAY=(81:64,2,60,3,CHANGE=(2,C'JAN',C'01',                   
                                    C'FEB',C'02',                   
                                    C'MAR',C'03',                   
                                    C'APR',C'04',                   
                                    C'MAY',C'05',                   
                                    C'JUN',C'06',                   
                                    C'JUL',C'07',                   
                                    C'AUG',C'08',                   
                                    C'SEP',C'09',                   
                                    C'OCT',C'10',                   
                                    C'NOV',C'11',                   
                                    C'DEC',C'12'),57,2,             
            57:81,6,Y2T,TOGREG=(Y4T)))                               
  OUTFIL FNAMES=(SORTOUT),                                           
    REMOVECC,                                                       
    BUILD=(C'odstrig Dscof#Tr1g#2k26',80:X,/,                       
           C'mode stream',/,                                         
           C'type binary',/,                                         
           C'cd /dsap/home/dspaprep/ETL/rundatefiles',/,             
           C'delete TSYS_clndr_event_',57,8,C'.txt',/,               
           C'put ''ALT0.TSYS.BATCH.STATS.RUNDATE(0)''',X,           
           C'TSYS_clndr_event_',57,8,C'.txt',/,                     
           C'quit')                                                 
  END                                                               
/*


Use the SORTOUT as input for your FTP.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 5:47 pm
Reply with quote

I tried this approach I am getting syntax error let me put here.

my input file:

Code:
 Command ===>                                                  Scroll ===> CSR
 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
 ****** ***************************** Top of Data *****************************
 000001 TSYS TSYS_MAY_2026                                      15-JAN-26 09-DE
 ****** **************************** Bottom of Data ***************************


my actual job :

Code:
[code]//STEP0001 EXEC  PGM=SORT                                   
//SORTIN   DD DSN=tnv.env.abd.abc.xxxxx.input1,   
//            DISP=SHR                                     
//SORTOUT  DD DSN=tnv.env.abd.abc.xxxxx.OUTPUTE1,   
//             SPACE=(CYL,(1,1),RLSE),                     
//             DCB=(RECFM=VB,LRECL=80,BLKSIZE=0,DSORG=PS), 
//             DISP=(NEW,CATLG,DELETE)                     
//SYSOUT   DD SYSOUT=*                                     
//SYSPRINT  DD SYSOUT=*                                     
//SYSIN    DD *       
           OPTION COPY,VLSCMP                                     
   DEBUG ABEND,NOESTAE                                 
   INREC IFTHEN=(WHEN=INIT,                             
     OVERLAY=(81:64,2,60,3,CHANGE=(2,C'JAN',C'01',     
                                     C'FEB',C'02',     
                                     C'MAR',C'03',     
                                     C'APR',C'04',     
                                     C'MAY',C'05',     
                                     C'JUN',C'06',     
                                     C'JUL',C'07',     
                                     C'AUG',C'08',     
                                     C'SEP',C'09',     
                                     C'OCT',C'10',     
                                     C'NOV',C'11',     
                                     C'DEC',C'12'),57,2,
                  57:81,6,Y2T,TOGREG=(Y4T)))           
                    OUTFIL FNAMES=(SORTOUT),   
                       OUTFIL FNAMES=(SORTOUT),                     
                   REMOVECC,                                   
                   BUILD=(C'ODSTRIG DSCOF#TR1G#2K26',80:X,/,   
                          C'MODE STREAM',/,                   
                          C'TYPE BINARY',/,                   
                          C'CD                                 
               /DSAP/HOME/DSPAPREP/ETL/RUNDATEFILES',/,       
                          C'DELETE                             
               TSYS_CLNDR_EVENT_',57,8,C'.TXT',/,             
                          C'PUT                               
               ''ALT0.TSYS.BATCH.STATS.RUNDATE(0)''',X,       
                          C'TSYS_CLNDR_EVENT_',57,8,C'.TXT',/,
                          C'QUIT')   
    END
/*[/code]
                         
 My error:

[code]   END                                                                 
 WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED       
 WER268A  OUTFIL STATEMENT  : SYNTAX ERROR                             
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                       
 WER578I  SORTL INSTRUCTION NOT USED; REASON CODE=FE                   
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                         
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE   [/code]                           

                                       
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 6:22 pm
Reply with quote

i did some changes now i am getting this error:

Code:
 WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED   
 WER276B  SYSDIAG= 2188232, 13710883, 13710883, 14786190           
 WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
 WER164B     0 BYTES RESERVE REQUESTED, 992K BYTES USED           
 WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                   
 WER108I  SORTIN   : RECFM=VB   ; LRECL=   256; BLKSIZE= 27998     
 WER073I  SORTIN   : DSNAME=ALT0.TSYS.BATCH.STATS.RUNDATE.G2667V00
 WER257I  INREC RECORD LENGTH =   256                             
 WER235A  SORTOUT  OUTREC RDW NOT INCLUDED                         
 WER448I  Y2 FORMAT CENTURY WINDOW IS FROM 2026 TO 2125           
 WER578I  SORTL INSTRUCTION NOT USED; REASON CODE=F6               
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Jan 28, 2026 6:44 pm
Reply with quote

Have you tried my sample first before changing anything? Your input is a variable DSN, not fixed.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 7:40 pm
Reply with quote

Yes i tried your code while using your sample code i am getting below errors:

Code:
 WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED   
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT                   
 WER578I  SORTL INSTRUCTION NOT USED; REASON CODE=FE               
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     
 ******************************** END OF DATA
*********************

yes my input file is VB with 256 length. shall i change it to FB first and then try ? please suggest.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10902
Location: italy

PostPosted: Wed Jan 28, 2026 8:06 pm
Reply with quote

The TS is using SYNCSORT ( WER prefix messages )
will a moderator please move the topic where it belongs,
the SYNCSORT section !
thank You
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Wed Jan 28, 2026 8:29 pm
Reply with quote

Joerg.Findeisen I am close to solution i just need bit of guidance here we can close the topic then.
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 166
Location: India

PostPosted: Thu Jan 29, 2026 11:03 am
Reply with quote

@enrico-sorichett how we can move this to Syncsort section ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10902
Location: italy

PostPosted: Thu Jan 29, 2026 1:41 pm
Reply with quote

I did not write "You", I wrote ...

will a moderator please move the topic where it belongs
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2283
Location: USA

PostPosted: Fri Jan 30, 2026 9:18 pm
Reply with quote

Digvijay Singh wrote:

yes my input file is VB with 256 length. shall i change it to FB first and then try ? please suggest.


No. You only MUST use the SORT control statements matching YOUR ACTUAL INPUT FILE ATTRIBUTES.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2283
Location: USA

PostPosted: Fri Jan 30, 2026 9:22 pm
Reply with quote

Take a look at this "updated" code:
Code:
                    OUTFIL FNAMES=(SORTOUT),   
                       OUTFIL FNAMES=(SORTOUT),                     
                   REMOVECC,                                   

Can you notice the difference with Joerg's working sample?
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
No new posts Sort card to know that creation date ... DFSORT/ICETOOL 10
No new posts Convert CSV to flat file. DFSORT/ICETOOL 6
Search our Forums:


Back to Top