Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Syncsort to identify date of Monday for any given weekday

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL
Author Message
Puspojit

New User


Joined: 10 Mar 2008
Posts: 35
Location: Pune

PostPosted: Fri May 02, 2008 9:05 pm    Post subject: Syncsort to identify date of Monday for any given weekday
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
References
PostPosted: Fri May 02, 2008 9:05 pm    Post subject: Re: Syncsort to identify date of Monday for any given weekday Reply with quote

Skolusu

DFSORT Developer


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

PostPosted: Fri May 02, 2008 9:56 pm    Post subject:
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: 35
Location: Pune

PostPosted: Sat May 03, 2008 2:13 pm    Post subject: Reply to: DFSORT to identify date of Monday for any given we
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
Moved: Sat May 03, 2008 2:16 pm by dick scherrer From DFSORT/ICETOOL to JCL
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 6728
Location: 221 B Baker St

PostPosted: Sat May 03, 2008 2:19 pm    Post subject:
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: 35
Location: Pune

PostPosted: Sat May 03, 2008 4:16 pm    Post subject: Reply to: Syncsort to identify date of Monday for any given
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: 183
Location: USA

PostPosted: Mon May 05, 2008 9:41 pm    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1