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

DATE2 function


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Thu Aug 24, 2023 7:59 pm
Reply with quote

Hi My request is to have Header in all outfile and Header should have MOnth and Year from current date.

Sort provided function DATE2 but i tried various way and sort step only fail , can you guide how can i use this. SPent lot of time searching and doing R&D but no success
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Aug 24, 2023 8:34 pm
Reply with quote

aura21 wrote:
Hi My request is to have Header in all outfile and Header should have MOnth and Year from current date.

Sort provided function DATE2 but i tried various way and sort step only fail , can you guide how can i use this. SPent lot of time searching and doing R&D but no success


PLEASE!!!!!!

Provide the code you have used, and the exact errors you have got.

Otherwise it is just wasting of time - reading meaningless postings on the forum.

P.S.
Do not reply that "your code is a Top Secret information".
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Thu Aug 24, 2023 8:45 pm
Reply with quote

***************************** Top of Data **************************
SORT FIELDS=(8,18,CH,A)
OMIT COND=(1,4,CH,EQ,C'BANK',OR,
1,1,CH,EQ,C'9',OR,1,1,CH,EQ,C'T')
OUTFIL REMOVECC,
HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:DATE2(-),/,
1:'BETA ',
'GMMA A ',
'AMOUNT ',
'AMT NUMBER ',
'DATE '),
BUILD=(1,80),
SECTIONS=(8,18,TRAILER3=('9',X,10,18,X,COUNT=(M10,LENGTH=8),51X)),
TRAILER1=(1:'T',X,
3:COUNT=(M10,LENGTH=13),X, * REC COUNT LEADING SPACES
17:TOT=(53,13,ZD,M10,LENGTH=18),46X) * TOT AMT LEADING SPACES
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Fri Aug 25, 2023 12:54 am
Reply with quote

It is showing syntax error, with same card if I use DATE=4MD or dateins result are good.but with Date2 it fails
I am not able to fix so wanted ur help asap if poasible
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Fri Aug 25, 2023 2:46 am
Reply with quote

This is what the manual says:
Quote:
&DATE2 [{±}nnn]


This is what you are using in your code
Code:
 HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:DATE2(-),/,


Please, wipe your eyes, and try to find the difference.

If you cannot, then I give up… icon_pai.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 25, 2023 11:35 am
Reply with quote

Make use of symbols, it's easy to fix. Add to the job:

Code:
//SYMNAMES DD *   
MyYear,S'&LYR4.'   
MyMonth,S'&LMON.' 
/*                 


and change OUTFIL as follows:

Code:
OUTFIL REMOVECC,                                                   
  HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:MyYear,C'-',MyMonth,/,


BTW: The word "asap" leads always to slower processing of any help by the volunteers of this forum. If you need something asap, hire a well paid professional.
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Fri Aug 25, 2023 4:31 pm
Reply with quote

SORRY for using the word ASAP
i was trying hard and i am not getting any manual with example but could not find any

sergeyken i really appreicate your reply and your efforts to self find the solution.

i am yet not getting the fix..any one example can atlease give some start
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Fri Aug 25, 2023 4:57 pm
Reply with quote

For date values in the form C’yyyy-mm’, you could use the DATE2(-) constant;

I USED THIS BUT NOT WORKING
THE FORUM IS FOR HELP AND TO SAVE TIME
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 25, 2023 5:29 pm
Reply with quote

aura21 wrote:
For date values in the form C’yyyy-mm’, you could use the DATE2(-) constant;

I USED THIS BUT NOT WORKING
THE FORUM IS FOR HELP AND TO SAVE TIME

See what I have written and do not complain that volunteers spend their spare time to assist you.
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Fri Aug 25, 2023 5:46 pm
Reply with quote

//SYMNAMES DD *
JP1,S'&LYR4.'
JP2,S'&LMON.'
/*

Getting syntax error:

SORT FIELDS=(8,18,CH,A)
OMIT COND=(1,4,CH,EQ,C'BANK',OR,
1,1,CH,EQ,C'9',OR,1,1,CH,EQ,C'T')
OUTFIL REMOVECC,
HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:JP1,C'/',JP2,/,
*
1:'TV CODE ',
'TV NUMBER ',
'AMT N ',
'NUMBER ',
'PDDATE '),
BUILD=(1,80),
SECTIONS=(8,18,TRAILER3=('9',X,10,18,X,COUNT=(M10,LENGTH=8),51X)),
TRAILER1=(1:'T',X,
3:COUNT=(M10,LENGTH=13),X, * REC COUNT LEADING SPACES
17:TOT=(53,13,ZD,M10,LENGTH=18),46X) * TOT AMT LEADING SPACES
WER813I INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER578I SORTL INSTRUCTION NOT USED; REASON CODE=FE


Appreciate all members efforts. it is just i am trying from 3 days and still nothing
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Fri Aug 25, 2023 5:51 pm
Reply with quote

If you tried to read the manual carefully, you would find that the only date formats allowed for HEADER/TRAILER parameters are as follows:
Quote:
&DATE [{±}nnnn]
&DATE=(m1m2m3m4 )[{±}nnnn]
&DATENS=(xyz)[{±}nnnn]
&YDDD=(m1m2m3)[{±}nnnn]
&YDDDNS=(m1m2)[{±}nnnn]


All other date formats (including &DATE2 - with ampersand!!!) are used only for data records, not for headers/trailers.

Just use any of allowed code, and forget about absolutely stupid initial requirements.
Code:
HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:&DATE=(4MD-),/,     


Code:
********************************* TOP OF DATA *************
MONTHLY FILE CREATED ON : 2023-08-25                       
BETA GMMA A     AMOUNT        AMT NUMBER        DATE       
1234567890                                                 
******************************** BOTTOM OF DATA ***********


P.S.
You are still not able even to learn how to use the Code button! To say nothing about RTFM...
Back to top
View user's profile Send private message
aura21

New User


Joined: 23 Aug 2023
Posts: 7
Location: india

PostPosted: Fri Aug 25, 2023 5:57 pm
Reply with quote

I had used this - it gave me full date which is not the ask of my request.

we just want year and month in the file header.

I am trying to use Parameters but that is also showing same syntax error

appreciate your time to help me in all stages.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Fri Aug 25, 2023 6:00 pm
Reply with quote

aura21 wrote:
I had used this - it gave me full date which is not the ask of my request.

we just want year and month in the file header.

I am trying to use Parameters but that is also showing same syntax error

appreciate your time to help me in all stages.


It look like you even do not read the detailed explanation, but continuously repeat your mantras...
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Fri Aug 25, 2023 6:24 pm
Reply with quote

One more way to satisfy your absolutely senseless initial requirement:
Code:
//REPORT EXEC PGM=SORT,PARM='JP0"&LYR4-&LMON"'
 . . . . . . .
HEADER1=(1:C'MONTHLY FILE CREATED ON : ',27:JP0,/,   
 . . . . . . . .   
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Aug 25, 2023 11:16 pm
Reply with quote

Btw, that Topic should be moved to the SYNCSORT section. Not even able to chose the right part of the forum, these Software Engineers nowadays.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Aug 26, 2023 10:19 am
Reply with quote

Moved to SYNCSORT
Try www.ibmmainframeforum.com/syncsort-synctool/topic8077.html
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts COBOL 6.4 - User Defined Function nee... COBOL Programming 6
No new posts Calling an Open C library function in... CICS 1
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
Search our Forums:

Back to Top