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

Syncsort to identify date of Monday for any given weekday


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

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Fri May 02, 2008 9:05 pm
Reply with quote

Hi,

I have a weekly job which is run generally between Friday-Sunday.
However in special circumstances,this may change to any week day.
The o/p file has a field START-DATE which needs to be populated
with the date of MONDAY in that week.
Eg:
Job run on Friday(2008/05/02)
START DATE should be 2008/04/28
Job run on Saturday(2008/05/03)
START DATE should be 2008/04/28
Job run on Sunday(2008/05/04)
START DATE should be 2008/04/28

Could this be accomplished through DFSORT or is COBOL program the only way to achieve this?

Regards,
Puspojit

Second Friday edited to Saturday
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 02, 2008 9:56 pm
Reply with quote

Puspojit,


The following DFSORT JCL will give you the desired results. I assumed that your input file is 80 bytes as LRECL and FB RECFM. I also assumed that you wanted the START Date field propaged in pos 20 in CCYY-MM-DD format. if you need someother format then let me know and we can change the job accordingly.

We use the system symbol LWDAY system symbol which gives you the day of the week for current date. Based on this field we pick the date using IFTHEN statement

Code:

//STEP0100 EXEC PGM=ICEMAN                                     
//SYMNAMES DD *                                               
DAYNAME,S'&LWDAY'                                             
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
RECORD - 01                                                   
RECORD - 02                                                   
RECORD - 03                                                   
RECORD - 04                                                   
RECORD - 05                                                   
RECORD - 06                                                   
RECORD - 07                                                   
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTREC IFOUTLEN=80,                                         
    IFTHEN=(WHEN=INIT,OVERLAY=(81:DAYNAME,DATE1(-)-1,         
    DATE1(-)-2,DATE1(-)-3,DATE1(-)-4,DATE1(-)-5,DATE1(-)-6)), 
    IFTHEN=(WHEN=(81,3,CH,EQ,C'MON'),OVERLAY=(20:DATE1(-))),   
    IFTHEN=(WHEN=(81,3,CH,EQ,C'TUE'),OVERLAY=(20:084,10)),     
    IFTHEN=(WHEN=(81,3,CH,EQ,C'WED'),OVERLAY=(20:094,10)),     
    IFTHEN=(WHEN=(81,3,CH,EQ,C'THU'),OVERLAY=(20:104,10)),     
    IFTHEN=(WHEN=(81,3,CH,EQ,C'FRI'),OVERLAY=(20:114,10)),     
    IFTHEN=(WHEN=(81,3,CH,EQ,C'SAT'),OVERLAY=(20:124,10)),     
    IFTHEN=(WHEN=(81,3,CH,EQ,C'SUN'),OVERLAY=(20:134,10))     
/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Sat May 03, 2008 2:13 pm
Reply with quote

Hi,

Thanks for the sort card......it suits my requirement( whatever I understood from the step).
However,The above sort card gives me an error message
Code:

*** ERRORS IN SYMNAMES STATEMENTS ***
  DAYNAME,S'&LWDAY'
          *
*** SYNTAX ERROR ***
WER470A  SYMNAMES ERRORS FOUND


Could you please suggest me reason for the same?

Thanks and Regards,
Puspojit
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 03, 2008 2:19 pm
Reply with quote

Hello,

Quote:
Could you please suggest me reason for the same?
You are using Syncsort. The posted solution is for DFSORT.

What release of Syncsort are you running? The version is shown at/near the top of the output messages.
Back to top
View user's profile Send private message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 34
Location: Pune

PostPosted: Sat May 03, 2008 4:16 pm
Reply with quote

Sorry ... I got it
I am using
Code:

 SYNCSORT FOR Z/OS  1.2.2.2R    U.S. PATENTS:



Regards,
Puspojit
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon May 05, 2008 9:41 pm
Reply with quote

Support for symname symbolics was included in SyncSort for z/OS 1.3.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Jan 23, 2009 8:20 pm
Reply with quote

Quote:

Support for symname symbolics was included in SyncSort for z/OS 1.3.


We are running SYNCSORT FOR Z/OS 1.2.3. But, SYMNAMES works for me !!!

Can you please tell how it could happen?

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Jan 24, 2009 1:54 pm
Reply with quote

Ramsri,

Alissa was mentioning about symname SYSTEM symbolics. SYMNAMES will definitely work for you, but not a system symbol like &LWDAY mentioned above.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top