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

DFSORT - Yesterday date with CYYMMDD


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Thu Jul 28, 2011 3:30 pm
Reply with quote

Hi

Input File : 1110724XXXXXXXXXXX..

I have to use this input file and write Yesterday date with CYYMMDD this format and copy remaining data.

Runing in July26
Output file should be

Output : 1110725XXXXXXXXXXX..
I need to write in DFSORT only. Can you plese help on this.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 28, 2011 4:09 pm
Reply with quote

Do you mean irrespective of date in your input file.. you want yesterdays date inthe output file at same position?
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Thu Jul 28, 2011 4:11 pm
Reply with quote

Yes... Correct
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Jul 28, 2011 4:20 pm
Reply with quote

Hi.... This might help you...
Code:

//STEPORT  EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                 
1110724XXXXXXXXXXXYY                             
/*                                               
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
  INREC FIELDS=(01:DATE1,9:8,13)                 
  OUTREC FIELDS=(01:1,2,                         
                 CHANGE=(1,C'20',C'1',           
                           C'21',C'2'),         
                 2:3,4,                         
                 6:7,2,ZD,SUB,+1,EDIT=(TT),     
                 8:9,13)                         
/*                                               


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

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Jul 28, 2011 4:23 pm
Reply with quote

You can also put
Code:

,NOMATCH=(set)


in the change clause if the there is no match.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 28, 2011 4:24 pm
Reply with quote

vicky10001 wrote:
Yes... Correct


Even if yesterday is weekend/holiday?
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Thu Jul 28, 2011 6:22 pm
Reply with quote

Thanks gylbharat.. Its working fine
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 28, 2011 6:49 pm
Reply with quote

gylbharat wrote:
Hi.... This might help you...

Thanks


Gylbharat, What if date is first of the month?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Jul 28, 2011 7:02 pm
Reply with quote

Escapa wrote:
gylbharat wrote:
Hi.... This might help you...

Thanks


Gylbharat, What if date is first of the month?


Sorry... Missed that condition....

Code:

//STEPORT  EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
1110724XXXXXXXXXXXYY                             
/*                                               
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=COPY                               
  INREC FIELDS=(01:DATE1-1,9:8,13)               
  OUTREC FIELDS=(01:1,2,                         
                   CHANGE=(1,C'20',C'1',         
                             C'21',C'2'),         
                   2:3,6,                         
                   8:9,13)                       
/*                                               
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: Thu Jul 28, 2011 9:07 pm
Reply with quote

Hello,

Quote:
Thanks gylbharat.. Its working fine

Quote:
Sorry... Missed that condition....


Which indicates insufficient testing on both sides. . .

I mention this because many people take code given and use it with little or no proper testing/validation. Just a caution. . . icon_neutral.gif

d
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jul 28, 2011 9:09 pm
Reply with quote

vicky10001,

An easier approach would be a simple subtraction of 19 from the century portion. This will take care of any one simulating a 19xx dates and future dates up 2899-12-31. I assumed that the LRECL=80 and RECFM=FB

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
1110724XXXXXXXXXXX.                         
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  INREC BUILD=(DATE1-1,8,73)                 
  OUTREC BUILD=(1,2,ZD,SUB,+19,EDIT=(T),3,79)
//*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Jul 28, 2011 9:10 pm
Reply with quote

Ohhh... I didn't notice... Even OP was happy with the code.. icon_rolleyes.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jul 28, 2011 9:15 pm
Reply with quote

Quote:
Which indicates insufficient testing on both sides. . .
Back in my teaching days, I used to assign a homework problem:
Quote:
You have been asked to generate test cases adequate to completely test this rpobelm:
Quote:
Write a program that accepts as input 3 integers representing the lengths of the sides of a triangle. Output of the program should indicate if the triangle is equlateral, isoceles, or scalene.
DO NOT WRITE THE PROGRAM -- JUST THE TEST CASES!
It was a rare student who managed to come up with more than half the test cases.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top