Focal Point
Passing a Date from JCL to Focexec

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8331077331

February 27, 2004, 08:27 PM
<Lisa Baldwin>
Passing a Date from JCL to Focexec
I'm new to this forum and this may have been covered before but here goes.... I am using Mainframe Focus 7.1.1. I am executing a fex through JCL and I would like to pass the last business date from my JCL to my Focexec. We have a table established for backdates which takes into consideration all Holidays, weekends, etc., that we use when executing COBOL programs.

When I was executing the fex directly from Focus, I prompted for the last business date and used the date entered to test for desired records in my DB2 database. Now that this fex to be run using JCL the operators never see the prompt because they are in the TSO environment. I would like to pass the last business date from the JCL/Proc to my Focexec for testing. Does anyone know how to do that?

Thanks,
Lisa
May 13, 2004, 03:31 PM
Chris Boylan
Hello, Lisa,

I know it's been a while but I just happened upon this post. You can pass any parameter to a FOCEXEC very easily. If FRED is the name of your FOCEXEC, and &BUSDATE is the FOCUS amper variable you need to pass to it for screening purposes, and you already have the busdate value available in the JCL stream, then just include:

EX FRED BUSDATE=010101

where "010101" is your parameter name for the date in the JCL stream.

Alternatively, if the last business date is stored in a flat file somewhere, then you can use
-READ to read the parm from the external file with code similar to this in a FOCEXEC.

-READ DD1 &&BUSDATE
EX FRED BUSDATE=&&BUSDATE

(DD1 would be allocated to the flat file that contains the busdate value).

Keep in mind that FOCUS &VARIABLES cannot be resolved directly in JCL (as the DM command processor is not invoked), so if you are using FOCUS &VARS or &&VARS, make sure to use these within a FOCEXEC.

Hope that helps.

-Chris
May 17, 2004, 02:38 PM
<monte2000>
From Art Greenhaus, FOCUS Wizard:

The REAL question is HOW you are going to get this date in JCL? I'm guessing that you'll run a step, which executes your program (or it COULD be FOCUS), to place the 'last business date' into some dataset. Then, the issue is, 'how can FOCUS read that date?'. That's EASY.

In the Dialogue Manager, you can read and write using a -READ and -WRITE statement. Assume the file is called 'lastdate.data'. First, you allocate it using either JCL (ugly), or a DYNAM command (keeping it within FOCUS), like
this:

DYNAM ALLOC DD LDATE DA LASTDATE.DATA SHR REU -RUN

You need the '-RUN', so the DYNAM executes, BEFORE the next -READ.

Then, you can read that file with a -READ (assuming the value is 8 characters):

-READ LDATE &LBUSDATE.A8.
December 17, 2004, 05:46 PM
nolanja
To expand on this does anyone have an example of using a JCL variable to pass a value to a focexec variable. The only way I see right now would be to write a REXX to create a dynamic sysin before the Focus step, but it would be nice if there was a quicker/cleaner way.

Jayem Nolan
RBC
December 17, 2004, 06:24 PM
<Pietro De Santis>
Why not create a short FOCUS program to read the table of dates to determine the last business date. Then INCLUDE this in all reports.
December 17, 2004, 09:04 PM
susannah
Lisa, i do this the really lazy way:
given that &YYMD is the system date variable
I get the day of week, decode it to some adjustment value, subtract that adjustment value from the current day, and that's my test value
-SET &DAY = DOWK(&YYMD,'A3');
-SET &ADJ = DECODE &DAY('SAT' 1 'SUN' 2 ELSE 0);
-SET &ADJ = -1 * ADJ ;
-DOAGAIN
-SET &LASTDAY = AYMD(&YYMD, &ADJ, 'I8YYMD');
TABLE FILE whatever
..do stuff
IF SOMEDATE EQ &LASTDAY
END
-RUN
-IF &LINES GT 0 GOTO PROCESS;
-SET &ADJ = &ADJ - 1 ;
-GOTO DOAGAIN ;
-* or you could bail out and not reloop for yesterday
-PROCESS
This way if i have data, we must have been open and in operation. If i have no data, it must have been a holiday. This is the most painless, least elegant way i can think of.
December 22, 2004, 12:49 PM
nolanja
I was not looking to pass date values, but any value/parm to the focexec directly from the JCL using the JCL set statement.

//MYLBL SET MODE='DEBUG'

EX FP1TEST MODE=&MODE

-TYPE &MODE
&MODE <----- Should be debug

It might not be possible to do this but thought I would put it out there.

Jayem Nolan
RBC