I was wondering if you could help me set up a sort step where I would not have to reset the condition every year.
Right now I have a file with records with both years 2011 and 2012 (these values are in the data). I can easily separate those into two files right now.
But, next year I will have records with data of 2012 and 2013, and the following year 2013 and 2014.
Is there a way to create a sort that will write two separate files based on the year (data) and I won't have to revise the sysin every year with the specific years that need to be sorted out?
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
Ummmm - as usual - show us some sample data including the positions, formats and lengths of the two fields, tell us the lrecl and recfm, and show us the expected output. Yes, I know that the output is going to be the same as the input but with both years incremented by one.
Hello again everyone!
Thank you so much for all your advice. It is obvious to me though, that I should have been more precise about my situation.
Here is the file layout of my 57 character length file. The first 2 bytes are the year shown as 11 or 12. I have to put the 11's in one file and the 12's in another. Next year the 12's in one file and 13's in another.
EDIT SYSTC.ADD.EXTRACT.TEST Columns 00001 00057
Command ===> Scroll ===> CSR
****** ***************************** Top of Data 110103054000000303520111105000000045000000000000020120330
110150003000011358720110806000006815000000000000020120330
110150005000000000020110806000000000000000000000020120330
120150006000010974920110806000006584000000000000020120330
120150012000022387920120121000013432000000000000020120330
120150013000004085020120121000002451000000000000020120330
Based on the info I received, I tried this SYSIN without good results.
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(58:DATE1,58,8,Y4T,ADDYEARS,+1,TOGREG=Y4T)
OUTFIL FNAMES=OUT1,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,58,2,CH)
OUTFIL FNAMES=OUT2,BUILD=(1,57),INCLUDE=(1,2,CH,EQ,60,2,CH)
/*
Thanks again for your patience and understanding
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
If you need year minus one and current year, does subtracting instead of adding help you for this year?
What you haven't told is is the year with which you want to run the data. If you have 11 and 12 in the data, do you always run with 12? Same situation in future years? I think the subtract should work.
If not, what are the rules for the "current year" when you run?
You are right. This year I run with 12's and the old year 11's.
Next Year with 13's and the old year 12's.
I tried using subtraction, but my problem is that I'm not familiar with the overlay reserved words. Could you please help me with the overlay? I have this now.