× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi

I am trying to use the new CL data structures code.
But I either dont understand the concept or have something very wrong in
my code.
The Retreive Spool file attributes API returns its data in a large field.
(see code below)
Then I am trying to use the STG(*DEFINED) DEFVAR declaration.
The API returns the spool width as Packed Decimal 15.5 offset 888.

I can see the data I want in the variable &DS, but I cannot get the data
into
the overlay field &RTNWIDTH.

I eventually did a %SST to get the 8 bytes I need, into a CHAR 8 variable.
In the calling program I defined &RTNWIDTH as DEC 15,5 and this works OK.

What I am asking is what did I do wrong with the new CL code.
The archives mention using %OFS but I dont see how to use %OFS here.

PS. I realise this is the RPG list but I figure you guys would be best
qualified to help with this question.

/* GET A SPOOL FILE ATTRIBUTE
*/
/* FULLJOB format is JOB USER NUMBER 10char, 10char,6char */
/* This gets the LAST Spool file
created */

PGM PARM(&SPLF &FULLJOB &RTNWIDTH
)


DCL &SPLF *CHAR
LEN(10)
DCL &FULLJOB *CHAR
LEN(26)


DCL &SPLNBR *CHAR
LEN(5)
DCL &SPLNBRD *DEC LEN(9
0)
DCL &SPLNBRB *CHAR
LEN(4)


DCL &DSLEND *DEC LEN(9
0)
DCL &DSLENB *CHAR
LEN(4)


DCL &INTJOB *CHAR
LEN(16)
DCL &INTSPLF *CHAR
LEN(16)


DCL &DS *CHAR
LEN(1000)
DCL &RTNWIDTH *DEC (15 5) STG(*DEFINED) DEFVAR(&DS
888)

/* GET LAST SPOOL FILE */
CHGVAR &SPLNBRD -1
CHGVAR %BIN(&SPLNBRB 1 4) &SPLNBRD
/* USE 1000 BYTE DS */
CHGVAR &DSLEND 1000
CHGVAR %BIN(&DSLENB 1 4) &DSLEND

/* CALL API TO GET SPLFA */
/* OFFSET 888 CONTAINS THE WIDTH AS PACKED DECINAL 15,5 */
CALL QUSRSPLA PARM(&DS &DSLENB 'SPLA0100' +
&FULLJOB &INTJOB &INTSPLF &SPLF &SPLNBRB)

RTNWID: CHGVAR &RTNWIDTH &RTNWIDTH

RETURN
ENDPGM

Frank Kolmann

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.