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 - dates must be Monday and Sunday.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Nov 07, 2012 11:41 pm    Post subject: Syncsort - dates must be Monday and Sunday.
Reply with quote

Hi, we use Syncsort for z/OS v1.3.2. We receive a file (LRECL=80,RECFM=FB) with dates in it in CCYYMMDD format and need to check whether it belongs to Monday or Sunday.

Input:
Code:

20121008 20121014
20121023 20121028
20121105 20121113


As you could see, dates in 1st record belong to Monday and Sunday but in 2nd record start date is not Monday while end date is Sunday. In 3rd record, start date is Monday while end date is not Sunday. Is it possible to check the given dates and correct them to have Monday dates in start date and Sunday dates in end dates a week. icon_confused.gif

Expected Output:
Code:

20121008 20121014
20121022 20121028
20121105 20121112


Please help. Thanks.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 08, 2012 12:09 am    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

What if they are neither Monday nor Sunday?
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: Thu Nov 08, 2012 12:26 am    Post subject:
Reply with quote

Hello,

What if the dates are more than 6 days apart?

What if both dates are a Monday (or Friday)?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Nov 08, 2012 12:27 am    Post subject: Re: Reply to: Syncsort - given dates must belong to Monday a
Reply with quote

Bill Woodger wrote:
What if they are neither Monday nor Sunday?

If I understand the TS correctly, heesh is stating:
  1. If date #1 does not fall on a Monday, change it to the latest date before it that does fall on a Monday
  2. If date #2 does not fall on a Sunday, change it to the earliest date after date #1 that does fall on a Sunday.
  3. Hi, Opal!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 08, 2012 12:43 am    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

Well, if first date is a Monday, then 2nd date should be following Sunday.

If 2nd date is a Sunday, then first date should be the previous Monday.

So, if the first date is not a Monday AND the second date is not a Sunday....
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: Thu Nov 08, 2012 1:08 am    Post subject:
Reply with quote

Hello,

Looks like (to me) that even if something is implemented, it may not fill the actual need . . .
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Nov 08, 2012 2:32 am    Post subject: Re: Reply to: Syncsort - given dates must belong to Monday a
Reply with quote

Bill Woodger wrote:
Well, if first date is a Monday, then 2nd date should be following Sunday.

If 2nd date is a Sunday, then first date should be the previous Monday.

So, if the first date is not a Monday AND the second date is not a Sunday....

I agree with Mr. Scherrer that the requirement needs clarification. However, if the two rules ("Hi, Opal!" can be disregarded for this effort icon_biggrin.gif) are applied sequentially, I believe that they will cover all cases, even if the result is not always if desired.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Nov 08, 2012 7:55 am    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

Quote:

Well, if first date is a Monday, then 2nd date should be following Sunday.

If 2nd date is a Sunday, then first date should be the previous Monday.

So, if the first date is not a Monday AND the second date is not a Sunday....


Bill Woodger got me right.....Is it possible to achieve it in SYNCSORT?

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

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Nov 08, 2012 8:47 am    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

Started experimenting by doing this but don't get satisfactory results icon_sad.gif

Code:

//STEP0001 EXEC PGM=SORT         
//SORTIN   DD *                   
20121106 20121111                     
//SYSIN    DD *                   
 OPTION COPY                     
 OUTREC FIELDS=(1:12,6,Y2T,SUB,+6)
//SORTOUT  DD SYSOUT=*           
//SYSOUT   DD SYSOUT=*           


Output:
Code:

********************************* TOP OF DATA **********************************
       20121105                                                                 
******************************** BOTTOM OF DATA ********************************


Don't know why it does not sit at 1st position though I used "1:" in outrec icon_eek.gif icon_confused.gif Must be heading in wrong direction icon_rolleyes.gif

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

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Thu Nov 08, 2012 2:56 pm    Post subject:
Reply with quote

Round holes and square pegs...

How long would it have take you to do this in PL/I, Cobol or REXX?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 08, 2012 3:08 pm    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

Every time you do a calculation, if you do not specify a length for the result, you get the default length. The default length is 15 bytes.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Nov 08, 2012 3:22 pm    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

seems that the trend is reversed now,
up to a certain time nobody was aware/was using the advanced sort capabilities
and a program was written even for a simple reformatting

now it is the other way around , sort, alway sort, forever sort icon_cool.gif

just wondering about ...
non auditability of <sort> processes ,
( no hardcopy track of changes )

<sort>s going thru the JCL promotion/approval process
rather than the APPLICATION DEVELOPMENT one
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: Thu Nov 08, 2012 8:00 pm    Post subject:
Reply with quote

Hi Enrico,

Quote:
<sort>s going thru the JCL promotion/approval process
rather than the APPLICATION DEVELOPMENT one
Oh, yes. . .
Far too many places have allowed this to speed up the promotion process icon_sad.gif

Many of my clients have no rules for documenting the "code" in sort-grams or other utility processes. Once upon a time the sort basically sorted stuff and maybe tossed duplicates. Maybe not much of an issue then. Now business rules are being implemented this way as well as "batch spufi" that gets around the the need for a database review of a new process or fix-it. . .

Oh, well . . .
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Nov 08, 2012 8:16 pm    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

don't know PL/I or REXX.....

Bill, got results with your suggestion.....
Code:

//STEP0001 EXEC PGM=SORT                     
//SORTIN   DD *                               
20121106 20121111                             
//SYSIN    DD *                               
 OPTION COPY                                 
 OUTREC FIELDS=(1:12,6,Y2T,SUB,+6,LENGTH=9)   
//SORTOUT  DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       


Any other suggestion on how do I check for Monday/Sunday?

Thanks.
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: Thu Nov 08, 2012 8:24 pm    Post subject:
Reply with quote

Hello,

Quote:
don't know PL/I or REXX.....
Then COBOL may be the way for you to go . . .
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Nov 08, 2012 8:26 pm    Post subject:
Reply with quote

prino wrote:
How long would it have take you to do this in PL/I, Cobol or REXX?

(name decently suppressed) wrote:
don't know PL/I or REXX.....

I suggest that this states the reason, not only the existence of this thread, but for 99% of help boards.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 08, 2012 8:35 pm    Post subject: Reply to: Syncsort - given dates must belong to Monday and S
Reply with quote

Ramsri,

How about this one?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Nov 09, 2012 3:11 am    Post subject:
Reply with quote

Hi,

I doubt your date calculation is working, try this as an input
Code:
20121106 20121101                             


What is your result now ? Is it a valid date ?

The result I get is

Code:
20121095



Gerry
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 09, 2012 4:10 am    Post subject: Reply to: Syncsort - dates must be Monday and Sunday.
Reply with quote

Hi Gerry,

Which calculation?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Nov 09, 2012 4:24 am    Post subject:
Reply with quote

Hi Bill,

Code:
 OUTREC FIELDS=(1:12,6,Y2T,SUB,+6)



Gerry
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 -> SYNCSORT All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


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