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

Populate previous date in sort output


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Thu Nov 27, 2014 3:37 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Nov 27, 2014 3:47 pm
Reply with quote

Try DATE1(=)-1
Back to top
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Thu Nov 27, 2014 4:02 pm
Reply with quote

Hi,

I had tried that option before posting the query.

DATE1 was giving an error -

REPORT FIELD ERROR

Regards,
Varsha
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Nov 27, 2014 4:09 pm
Reply with quote

Could you post the complete sysout output?
Back to top
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Thu Nov 27, 2014 4:21 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Nov 27, 2014 4:32 pm
Reply with quote

Thumb rule is : There should be space in column 1 for SORT parms
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Nov 27, 2014 4:34 pm
Reply with quote

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
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Thu Nov 27, 2014 4:51 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Nov 27, 2014 7:21 pm
Reply with quote

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
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Thu Nov 27, 2014 8:51 pm
Reply with quote

Is that all you want to do, just generate two lines of output? If so, wouldn't a Rexx be easier?
Back to top
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Fri Nov 28, 2014 9:12 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Nov 28, 2014 12:38 pm
Reply with quote

Instead of a dummy SYSIN, have a SYSIN which contains nothing relevant.

Code:
//SYSIN DD ......


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
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Fri Nov 28, 2014 5:51 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Nov 28, 2014 7:02 pm
Reply with quote

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
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Mon Dec 01, 2014 2:09 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Dec 01, 2014 8:01 pm
Reply with quote

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
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Mon Dec 01, 2014 9:41 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Mon Dec 01, 2014 10:23 pm
Reply with quote

You need some input. What that input is does not matter. Which is why I showed the input previously.
Back to top
View user's profile Send private message
Varsha Varghese

New User


Joined: 27 Nov 2014
Posts: 8
Location: India

PostPosted: Tue Dec 02, 2014 11:16 am
Reply with quote

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
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top