|
View previous topic :: View next topic
|
| Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Hello All,
Could you please help with the below requirement.
Input file : (LRECL - 80 , RECFM - FB)
| Code: |
xxxxxxxx201209251709201209251830
yyyyyyyy201209251820201209260100 |
First 8 bytes in input file is jobname (position 1 - 8)
Next 12 bytes is actual start time of the job in format (YYYYMMDDHHMM) (position 9 - 20)
Next 12 bytes is actual end time of the job in format (YYYYMMDDHHMM)
(position 21-32)
Output file: (LRECL - 30 , RECFM - FB)
| Code: |
XXXXXXXX201209250121
yyyyyyyy201209250640
|
Output file includes 2 fields
1. first field is jobname - (position 1- 8)
2. second field is actual run time ( actual end time - actual start time)
Thanks
Madishpa
Code'd and number of "y"s corrected. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You could have a look at this one.
EDIT.
I assume that the "date" part you want on the output is that of the end of the run? Rather than the date part being subtracted? But that you want the difference in hours and minutes (not bothered about seconds?) even if start on one day, end on a different one? |
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
I would convert hours and miutes in to seconds before subtraction.
If the start and end dates falls on the same day, this works.
could you please help me how to handle in the case where the start and end dates falls on the different day.
Thanks
Madishpa |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
Madishpa,
I see you spent many nanoseconds going over Bill's link.
DATEDIFF is what does the trick. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Did you look at the link provided? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| Bill Woodger wrote: |
| Did you look at the link provided? |
why? he wants his customized solution,
and does not want to wade thru any extraneous verbiage. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
madishpa,
If you are just waiting around for an answer, you'll need to at least provide the output from this step, so we can see what level of the product you have.
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/* |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| dbzTHEdinosauer wrote: |
| Bill Woodger wrote: |
| Did you look at the link provided? |
why? he wants his customized solution,
and does not want to wade thru any extraneous verbiage. |
Add a private message too.
| madishpa wrote: |
| I would convert hours and miutes in to seconds before subtraction. If the start and end dates falls on the same day, this works. |
Your sample data has only HHMM for time , why would you convert the time into seconds format? You just need to convert it into minutes.
Assuming that the date-time at position 21 is always greater or equal to the date-time at position 9 , the following DFSORT JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXXXXXX201209251709201209251830
YYYYYYYY201209251820201209260100
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=30,IFTHEN=(WHEN=INIT,
OVERLAY=(40:(17,2,ZD,MUL,+60),ADD,19,2,ZD,M11,LENGTH=8,
50:(29,2,ZD,MUL,+60),ADD,31,2,ZD,M11,LENGTH=8,
60:21,8,Y4T,DATEDIFF,9,8,Y4T,
70:(60,8,SFF,MUL,+1440),ADD,
50,8,ZD,SUB,40,8,ZD,M11,LENGTH=8,
80:70,8,ZD,DIV,+60,EDIT=(TT),
70,8,ZD,MOD,+60,EDIT=(TT),
17:80,4,10X))
//* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
madishpa,
Please do not PM anyone for assistance. If this happens again, there will be a Warning for you.
I notice that you have not even thanked Kolusu for the solution provided.
You did not use the Code tags, and made a mistake with your sample data which you'd have spotted easily if you had use the Code tags and Preview. This was corrected for you.
You mis-described your requirement.
You have been here long enough to know that all of the above you should have been done differently.
Next time, please, do not repeat any of these mistakes. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|