View previous topic :: View next topic
|
Author |
Message |
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi all,
I am trying to generate previous date in the output file using Sort.
I have tried below sort card for current date and it worked fine.
SORT fields=copy
outfil removecc,nodetail,
header1=(3:C'-B',date=(4MD=),C'=00:00:00:000000+',/,
3:C'-E',date=(4MD=),C'=23:59:59:999999'')')
Output as below -
-B2014=11=27=00:00:00:000000+
-E2014=11=27=23:59:59:999999')
Now instead of 2014=11=27, I need the previous date which is 2014=11=26.
I have tried giving date=(4MD=)-1.
However its throwing a syntax error. Could you please let me know how to obtain
previous date instead of current date in the above sort card.
REgards,
Varsha |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Try DATE1(=)-1 |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi,
I had tried that option before posting the query.
DATE1 was giving an error -
REPORT FIELD ERROR
Regards,
Varsha |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Could you post the complete sysout output? |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi,
Unfortunately copy paste is disabled outside client network. So not able to copy the exact error here.
However it looks like below -
SORT fields=copy
outfil removecc,nodetail,
header1=(3:C'-B',date1(=)-1,C'=00:00:00:000000+',/,
*
REPORT FIELD ERROR
3:C'-E',date=(4MD=),C'=23:59:59:999999'')')
*
BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
Hope this helps.
Regards,
Varsha |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thumb rule is : There should be space in column 1 for SORT parms |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
No - it does not help. Unless you use the code tags all formatting is lost so the data does not line up with the asterisks. However, what do you not understand about the line:
Quote: |
BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY |
? |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi,
I am including my sort card within a PDS member and the sort card starts at Col 3.
Yes I agree, the formatting is lost , so to make it more clear
The asterisk appears under D of DATE1 in the SYSOUT. Hope this helps.
Regards,
Varsha |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The manual wrote: |
You can choose to include any or all of the following report elements in your
report header:
v Blanks, character strings, and hexadecimal strings
v Unedited input fields from the first OUTFIL input record
v Current date in a variety of different forms
v Current time in a variety of different forms
v Page number, converted to different numeric formats, or edited to contain
signs, decimal points, leading zeros or no leading zeros, and so on. |
So you can't do what you want the way you want.
You will have to extend your records, using INREC, for instance, to include your edited date, and then reference that field in HEADER1 and chop the extension off your records in OUTFIL. |
|
Back to top |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
Is that all you want to do, just generate two lines of output? If so, wouldn't a Rexx be easier? |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi,
I do not have any input file. Sort input is set as dummy file. I only have Sort output file to generate and write the previous date to it.
In that case will I be able to use INREC statement ?
Also cant use REXX because as per the standards set by client, it is not allowed to move to production for a daily job.
Regards,
Varsha |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Instead of a dummy SYSIN, have a SYSIN which contains nothing relevant.
Content to be something like:
Code: |
There must be at least one line here, actual content irrelevant, but there must be something |
OPTION STOPAFT=1...
Change your OUTFIL to not use HEADER1 but to BUILD two records of the correct size and format.
You could also limit the processing in OUTFIL, so if someone removes or changes the STOPAFT you get a second limit.
You should use NULLOUT to set a RC so that if someone does dummy the input, the JCL will know. |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi,
Currently it is given as
SORTIN DD DUMMY,DCB=(RECFM=F,LRECL=80,BLKSIZE=0)
I have tried giving
SORT FIELDS=COPY
OUTFIL BUILD = (3:C'B......)
Instead of HEADER changed to BUILD
Sort output file is created with LRECL 80.
However I am getting the below error now
32 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 80 BYTE LRECL FOR SORTOUT.
Not able to understand why this error when output file is created with LRECL 80
Also where should I give OPTION STOPAFT=1...
Regards,
Varsha |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Put the OPTION statement first.
On your BUILD=(blah,/,blah) make it
Code: |
BUILD=(blah,80:X,
/,
blah,80:X) |
That will put a blank in the 80th position of your output record, and space-fill all the bytes from the last that you mention and position 80.
You are currently BUILDing records shorter than 80 bytes, so they won't be 80 bytes unless you make them so, no matter what. |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi Bill,
80:X resolved the 80 byte LRECL error.
Now the sort card is returning MAXCC=0. However the output file is not populated with date fields. It is coming empty.
This is the sort card -
SORT FILEDS=COPY
OPTION STOPAFT=1
OUTFIL BUILD=(3:C'B',.......... )
I have tried giving as OUTFIL FNAMES=SORTOUT,BUILD=(3:C'B',......)
This also dint work.
The sysout says
ICE055I 0 INSERT 0 ,DELETE 0
ICE054I 0 RECORDS-IN :0 , OUT - 0
ICE227I 0 SORTOUT : DELETED =0 , REPORT =0 , DATA = 0
ICE228I 0 SORTOUT : TOTAL IN =0, TOTAL OUT=0
ICE174I 0 NO DATA RECORDS FOR AN OUTFIL DATA SET, RC =0
ICE052I 0 END OF DFSORT
Does this mean that we cannot populate any data in a Sort output file using OUTFIL without input record ? Can it be done only through HEADER/TRAILER ?
Is there any other method to populate an Output file without a valid Input file ?
Regards,
Varsha Varghese |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Varsha,
In the future please use Code tags for readability and proper spacing:
Code: |
SORT FILEDS=COPY
OPTION STOPAFT=1
OUTFIL BUILD=(3:C'B',.......... ) |
Code: |
ICE055I 0 INSERT 0 ,DELETE 0
ICE054I 0 RECORDS-IN :0 , OUT - 0
ICE227I 0 SORTOUT : DELETED =0 , REPORT =0 , DATA = 0
ICE228I 0 SORTOUT : TOTAL IN =0, TOTAL OUT=0
ICE174I 0 NO DATA RECORDS FOR AN OUTFIL DATA SET, RC =0
ICE052I 0 END OF DFSORT |
|
|
Back to top |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
Varsha Varghese wrote: |
Also cant use REXX because as per the standards set by client, it is not allowed to move to production for a daily job. |
We have similar standards ourself, but that is based on Rexx being innefficient at processing large volumes of data. Sometimes it is the best option. Explain that to the client and tell them it will cost a lot of money for you to develop another solution.
The entire Rexx could have been written, tested and implemented in far less time than we've all spent discussing this. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You need some input. What that input is does not matter. Which is why I showed the input previously. |
|
Back to top |
|
|
Varsha Varghese
New User
Joined: 27 Nov 2014 Posts: 8 Location: India
|
|
|
|
Hi All,
This worked. Only change made is
Instead of
//SORTIN DD DUMMY,....
I gave as
//SORTIN DD *
DUMMY
/*
Thanks everyone for your valuable inputs.
Regards,
VV |
|
Back to top |
|
|
|