Copy Previous Record from a Flat file PS using JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Copy Previous Record from a Flat file PS using JCL

Postby saiyan_prince » Fri Jan 03, 2014 12:38 am

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!
Regards,
Saiyan Prince
---------------------------------------------------------------------
There only One certainty in Life,
A Strong Man stands above an Conquers all!
More We Fight More Powerful We become!
User avatar
saiyan_prince
 
Posts: 3
Joined: Fri Jan 03, 2014 12:18 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby NicC » Fri Jan 03, 2014 5:39 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby saiyan_prince » Fri Jan 03, 2014 1:03 pm

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
Regards,
Saiyan Prince
---------------------------------------------------------------------
There only One certainty in Life,
A Strong Man stands above an Conquers all!
More We Fight More Powerful We become!
User avatar
saiyan_prince
 
Posts: 3
Joined: Fri Jan 03, 2014 12:18 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Fri Jan 03, 2014 4:26 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby saiyan_prince » Fri Jan 03, 2014 8:35 pm

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"
Regards,
Saiyan Prince
---------------------------------------------------------------------
There only One certainty in Life,
A Strong Man stands above an Conquers all!
More We Fight More Powerful We become!
User avatar
saiyan_prince
 
Posts: 3
Joined: Fri Jan 03, 2014 12:18 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Fri Jan 03, 2014 9:34 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post