Focal Point
parse data out of SIS ACRTTBL - control type = 054

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

May 12, 2005, 01:15 PM
<pkb>
parse data out of SIS ACRTTBL - control type = 054
Does anyone know how to parse out the date information in the SCT SIS table ACRTTBL section 54? The data is stored as comp-3 in this heavily re-defined table which only shows in focus the data as a large text field (CONTROL_DA A176). When I parse it out using EDIT in the Define Table I get ..q.&@
I need this date in a readable format.

I would appreciate any help.

thank you,
Pamela
May 12, 2005, 01:42 PM
Leah
What version of FOCUS, if on a mainframe that handles packed data okay, I had a routine, to go against a segment to extract the packed to display, however, we switched to WebFOCUS on a windows platform and that broke the model. Will dig it out and post when I get back to work on Monday.
May 12, 2005, 01:47 PM
<pkb>
Sorry for not providing thatinformation originally. I'm working on a mainframe using FOCUS 7.0.9 through CICS. I manuals says Focus for S/390
May 12, 2005, 01:50 PM
<pkb>
windows platform...I'll eventually give you all of the information.

sorry
May 13, 2005, 12:47 PM
Tom Walker
If your SIS system is using DB2, I can provide a solution.
May 16, 2005, 10:20 AM
<pkb>
We are using DB2 here at Kent State University.

Pamela
May 16, 2005, 12:26 PM
Tom Walker
I use the below code for control_type '055' to extract the term and the dates. The technique should transfer to your control_type. Most of the code in the define relates to the term, so you can discard that if you are only after the dates.

[code]
-******************************************************************
-* GET DATA FROM THE ACRTTBL FILE. *
-* Use some trickery to get the term, session, start, end dts *
-* term is pos 6-8 in control key, session in pos 9. But the data
-* is stored as bit data, so special focus defines are needed to
-* reconstruct the actual print characters. The dates are stored
-* as packed data, but focus can't directly unpack the db2 fields
-* stored as character strings, thus we use substr(hex(...)) to
-* get the dates
-*
-* CONTROL_KEY HEX_END_DT HEX_END_DT2
-* ----------- ---------- -----------
-* 202043323030343151202020202020 020040301F 20040301
-* 202043323030343152202020202020 020040109F 20040109
-* 202043323030343141202020202020 020040120F 20040120
-*****************************************************************

SQL DB2 SET CURRENT SCHEMA PRODADM;
SQL DB2
SELECT substr(CONTROL_KEY,6,4) as control_key,
substr(hex(SUBSTR(CONTROL_DATA,1,5)),2,8) AS START_DT,
substr(hex(SUBSTR(CONTROL_DATA,6,5)),2,8) AS END_DT
FROM sis_control_tb
where control_type = '055'
and substr(control_key,6,3) between '&TRM1' and '&TRM6'
and substr(control_key,9,1) > ' '
;
TABLE FILE SQLOUT
PRINT CONTROL_KEY START_DT END_DT
ON TABLE HOLD AS HOLDCAL
END
-RUN

DEFINE FILE HOLDCAL
CONTROLKEY/A08=CONTROL_KEY;

CA1/A1=SUBSTR ( 8, CONTROLKEY , 1, 1, 1, 'A1');
CB1/A1=SUBSTR ( 8, CONTROLKEY , 2, 2, 1, 'A1');
CH21/I2=(EDIT(CA1) * 16 )+ EDIT(CB1);
CHAR1/A1=HEXBYT(CH21,'A1');

CA2/A1=SUBSTR ( 8, CONTROLKEY , 3, 3, 1, 'A1');
CB2/A1=SUBSTR ( 8, CONTROLKEY , 4, 4, 1, 'A1');
CH22/I2=(EDIT(CA2) * 16 )+ EDIT(CB2);
CHAR2/A1=HEXBYT(CH22,'A1');

CA3/A1=SUBSTR ( 8, CONTROLKEY , 5, 5, 1, 'A1');
CB3/A1=SUBSTR ( 8, CONTROLKEY , 6, 6, 1, 'A1');
CH23/I2=(EDIT(CA3) * 16 )+ EDIT(CB3);
CHAR3/A1=HEXBYT(CH23,'A1');

CA4/A1=SUBSTR ( 8, CONTROLKEY , 7, 7, 1, 'A1');
CB4/A1=SUBSTR ( 8, CONTROLKEY , 8, 8, 1, 'A1');
CH24/I2=IF CB4 EQ 'A' THEN (EDIT(CA4) * 16 )+ 10 ELSE
IF CB4 EQ 'B' THEN (EDIT(CA4) * 16 )+ 11 ELSE
IF CB4 EQ 'C' THEN (EDIT(CA4) * 16 )+ 12 ELSE
IF CB4 EQ 'D' THEN (EDIT(CA4) * 16 )+ 13 ELSE
IF CB4 EQ 'E' THEN (EDIT(CA4) * 16 )+ 14 ELSE
IF CB4 EQ 'F' THEN (EDIT(CA4) * 16 )+ 15 ELSE
(EDIT(CA4) * 16 )+ EDIT(CB4);

CHAR4/A1=HEXBYT(CH24,'A1');

TERM/A3 =CHAR1 | CHAR2 | CHAR3;
SESSION/A1=CHAR4;

START_YYMD/I8YYMD = EDIT(START_DT) ;
END_YYMD/I8YYMD = EDIT(END_DT) ;
CAL_START/MDYY = START_YYMD;
CAL_END/MDYY = END_YYMD;
VALIDTERM/I5 = CHKFMT(3, TERM, '999', VALIDTERM);
END


[\code]