File Manager - Passing info between records.



Ask queries about other IBM Tools like Tivoli, COBTEST, Fault Analyzer, z/OS File Manager, Workload Simulator, APA, SCLM, Merge & Migration Tools etc...

File Manager - Passing info between records.

Postby jkusb » Fri Mar 15, 2013 10:05 pm

Hi... I am trying to write a Batch File Manager that looks at a value in the header record, then changes all other records based on that value. I would normally do this with a COBOL program or something, but I am trying to incorporate this into an existing Batch File Manager that is already written and does other things too. I am perfectly happy to look through manuals or google search to work through the details, but it would be very helpful if you could help me get started in the right direction. Thank you Very much for taking the time to help... Jeff.

I tried to use FCH to look at the header record then make a global change, but couldn't get it working...
the trouble was limitations of the Find command in Batch (no PREV or NX etc) and couldn't figure out how
to check the return code after the Find to see if the find was successful...
$$FILEM FCH INPUT=DD01
F ' ' 100 790
F 'ENV31' 22
C '0' '1' 1 122

I also tried this (not full code, but the important REXX varialbe and variable passing)
[Set Variable after reading the first record]
$$FILEM DSC INPUT=DD01,
$$FILEM OUTPUT=DD01O,
$$FILEM PROC=*
/* FASTREXX */
/* ?do something to interrigate a value in the first record? */
JKTYP = 7
ADDRESS ISPEXEC
'VPUT JKTYP SHARED'
EXIT;
[Then on all subsequent records... do something different for TYPE7 records]
[I also tried with ADDRESS ISPEXEC 'VGET JKTYP' but that caused the JOB to abend]
* FASTREXX */
IF JKTYP = 7 THEN DO
OUTREC = CHANGE(OUTREC,FLD(5,6),'777777',1,5,6)
END
EXIT;
jkusb
 
Posts: 10
Joined: Wed Oct 12, 2011 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: File Manager - Passing info between records.

 

Re: File Manager - Passing info between records.

Postby Ed Goodman » Sat Mar 16, 2013 1:21 am

You've got me interested...

What else does the existing rexx do? It it already handling the i/o?
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: File Manager - Passing info between records.

Postby Ed Goodman » Sat Mar 16, 2013 1:35 am

Oh, the reason for the abend is that the rexx environment you are running is NOT ispf, it's just the FileManager rexx environment. This ispf services are not available. The good news is that you can just use a variable.

My other question was: which command is the existing rexx running under? Like FCH or DSC?

If it's DSC, you can probably do something like:
If Substr(INREC,1,1) == '7' Then
mask_value = Substr(INREC,5,6)

then
OVLY_OUT(mask_value,5,6)
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: File Manager - Passing info between records.

Postby jkusb » Sat Mar 16, 2013 1:44 am

There is no existing REXX... I was just playing with adding the REXX to try and set a variable based on the header rec so I could check it when doing the later recs.

--> THE INPUT AND OUTPUT FILES ARE TAKEN CARE
--> ABOVE THIS, BUT HERE IS WHAT THE PROC PART LOOKS
--> LIKE, WHAT I NEED TO BE ABLE TO DO IS, WITHIN
--> THE IF I NEED TO SET SOMETHING SO THAT WHEN I
--> GET TO THE OVLY_OUT STATEMENT I CAN CHECK IT AND
--> SAY: IF HEADER-TYPE-7... DO THIS OVLY_OUT,
--> OTHERWISE... DO THIS OVLY_OUT
//SYSIN DD *
*+* FMC2FM: BEGINNING OF FILE MANAGER STATEMENT OUTPUT *+*
$$FILEM DSC INPUT=DD01,
$$FILEM OUTPUT=DD01O,
$$FILEM PROC=*
IF FLD(1,2) = 'FH' THEN DO
RETURN
END
OVLY_OUT('*',025,026,C,' ')
RETURN
/+
jkusb
 
Posts: 10
Joined: Wed Oct 12, 2011 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: File Manager - Passing info between records.

Postby Ed Goodman » Sat Mar 16, 2013 2:36 am

Then what I just posted should work fine. Just don't use 'FLD' because that implies a formatted view. If you use Instr instead, you can just view the input record unformatted.

You could even just make it one if-then-else.

You are overlaying an existing segment of the record right, not making it longer?
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: File Manager - Passing info between records.

Postby jkusb » Mon Mar 18, 2013 6:47 pm

WOW WOW WOW... YOU are the BEST!!! That was exactly the perfect solution... if there was any way to give you a "Thank You Brownie" I would :-)!
jkusb
 
Posts: 10
Joined: Wed Oct 12, 2011 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: File Manager - Passing info between records.

Postby Ed Goodman » Mon Mar 18, 2013 7:17 pm

What a great way to start the week!
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: File Manager - Passing info between records.

Postby Ed Goodman » Mon Mar 18, 2013 8:43 pm

Also, post your code if you can so that others can benefit from your effort.
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: File Manager - Passing info between records.

Postby jkusb » Mon Mar 18, 2013 11:32 pm

Glad to... you know, its amazing how something so 'little' can be the key to something quite big falling right into place :-)...

$$FILEM DSC  INPUT=DD01,                     
$$FILEM      OUTPUT=DD01O,                   
$$FILEM      PROC=*                           
 IF FLD(1,1) = 'F' THEN DO                   
  MASK_VALUE=SUBSTR(INREC,32,1)               
  RETURN                                     
 END                                         
 IF MASK_VALUE='7' THEN DO                   
   OVLY_OUT('7',120,001,C,' ')               
 END                                         
 ELSE DO                                     
   OVLY_OUT('9',120,001,C,' ')               
 END                                         
 RETURN                                       
/+


Code'd
jkusb
 
Posts: 10
Joined: Wed Oct 12, 2011 11:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: File Manager - Passing info between records.

Postby Ed Goodman » Tue Apr 01, 2014 4:33 am

Well, I got stuck tonight trying to figure out a process with FileManager. I came here and did a search, and GUESS WHO knew the answer! That's right..Ed Goodman. Ed Goodman knew how to do what I was trying to do with FileManager. It's a good thing I looked here, or I might NEVER have figured it out!

(I give myself a break because it's been more than a year)
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Next

Return to Other IBM Tools

 


  • Related topics
    Replies
    Views
    Last post