Page 1 of 1

Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 12:38 am
by saiyan_prince
I have a PS with the Following Data sample:

PXXXXLP0000001 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PACKAGE NOTES PROVIDED BY USER
PXXXXLP0000001 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
*================================================================
*================================================================
*INSTALL: OWNER
*INSTALL: SITE
*INSTALL: LPAR YYYYMMDD @ HH:MM
*INSTALL: LPAR YYYYMMDD @ HH:MM
*================================================================
PXXXXLP0000001 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PXXXXLP0000001 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PACKAGE NOTES PROVIDED BY USER
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
*================================================================
*================================================================
*INSTALL: OWNER
*INSTALL: SITE
*INSTALL: LPAR YYYYMMDD @ HH:MM
*INSTALL: LPAR YYYYMMDD @ HH:MM
*================================================================
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
. and so on...

I want to the output file to have Data of Package which has YYYYMMDD & falls in last week, this week and Next Week.
Like this sample if Pacakge PXXXXLP0000002's INSTALL YYYYMMDD satisfy the above:

PXXXXLP0000002 STATUS INSTALLSITE OWNER TIME EXECUTION_WINDOW
PACKAGE NOTES PROVIDED BY USER
*================================================================
*================================================================
*INSTALL: OWNER
*INSTALL: SITE
*INSTALL: LPAR YYYYMMDD @ HH:MM
*INSTALL: LPAR YYYYMMDD @ HH:MM
*================================================================

I tried this in REXX as REXX can read specified Records. But REXX ABENDS with Space issue as the Input PS might be more than 20K records.
So plan to use JCL in REXX, but can't Figure out How to use SORT utility to get the Previous Records when YYYYMMDD satisfy the COND.
I came across PUSH(1:133,SEQ=1) to get a set of Records after COND is satisfied, Is there any such to get the set of Records before the COND is satisfied.

Also can't Remove the Duplicate records of the Package information without Removing all Duplicates in the PS,
For instants,
*INSTALL: OWNER ----Record might be repeated for some other Package too,

SORT FIELDS=COPY
SUM=NONE
removes Every Duplicates and OMIT removes all Package Info Records.
Is there a way to Remove Duplicated with COND?

If this was already discussed please direct me. I tried searching but Hit no Jackpot!

Re: Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 5:39 am
by NicC
use JCL in REXX

What does this mean? Rexx is a programming language and JCL is a job control language - you cannot mix them. Rexx can be used to generate JCL but not the other way around.
What space issue? Can you not simply allocate your output witha larger space allocation?
Are you wanting a sort solution - in which case which sort product do you use? Or a resolution to your Rexx problem? If a sort problem then when you give us all the relevant information the topic can be moved to the appropriate sort forum.

Re: Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 1:03 pm
by saiyan_prince
I get the following while trying to get the Package details in REXX:

Abend 878000 hex occurred processing command 'EX '.

System abend code 878, reason code 00000016.
Unable to delete the specified REXX exec. It cannot be found.


I tried allocating Size ===> 990000 in TSO login but no use. And I can't make everyone who use this REXX code to allocate such space for their login, so moved to use JCL in REXX ( Yes, Rexx to generate JCL and submit it).

Now I face problem with Sort, I can't copy a Record which appears before the current record (one satisfy the COND "YYYYMMDD").

Thanks

Re: Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 4:26 pm
by Akatsukami
Although you have not shown any of your code, I would guess that you may be using EXECIO * DISKR. If so, I would suggest using EXECIO 1 DISKR in a loop do while (rcĀ¬=0). Another possibility is to use a compiled-language program to achieve your goal.

Re: Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 8:35 pm
by saiyan_prince
I tried this:

EOF = 0                                     
DO FOREVER UNTIL (EOF)                       
 "EXECIO 1 DISKR INFL (STEM DATARED."       
IF RC<>0 THEN EOF = 1                       
END                                         
"FREE F(INFL)"             


And got this:
EXECIO error. Unrecognized or ambiguous keyword option found. 
FILE INFL NOT FREED, DATA SET IS OPEN   


And a output Dataset which has no records fetched from the "INFL"

Re: Copy Previous Record from a Flat file PS using JCL

PostPosted: Fri Jan 03, 2014 9:34 pm
by Akatsukami
This is not well-written:
  1. There is no need to use the FOREVER repetitor
  2. WHILE should used in preference to UNTIL
  3. EOF ought not to be treated as a boolean, but as a numeric
  4. There is no close of INFL (by "EXECIO 0 DISKR INFL (FINIS")
But even if all these flaws were corrected, the net effect is the same as if you were using EXECIO *; you're trying to read the entire data set into memory, which is why it abends with (probably) a S878. Instead, read one record at a time. When you encounter a new package, start storing the records. When you read the install date, if it is within the desired range, write out the stored records and all newly-read records until the next package.