View previous topic :: View next topic
|
Author |
Message |
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Do you mean irrespective of date in your input file.. you want yesterdays date inthe output file at same position? |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Yes... Correct |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
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 |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
You can also put
in the change clause if the there is no match. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
vicky10001 wrote: |
Yes... Correct |
Even if yesterday is weekend/holiday? |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks gylbharat.. Its working fine |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
gylbharat wrote: |
Hi.... This might help you...
Thanks |
Gylbharat, What if date is first of the month? |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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. . .
d |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Ohhh... I didn't notice... Even OP was happy with the code.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|