Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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 & VSAM
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    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

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
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: 34
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
dick scherrer

Site Director


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

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: 34
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: 500
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
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Jan 23, 2009 8:20 pm    Post subject:
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: 2284
Location: @my desk

PostPosted: Sat Jan 24, 2009 1:54 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Could we identify the called modules ... elixir1986 COBOL Programming 5 Fri Jul 14, 2017 1:53 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us