× 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.



I wrote a CL program that would do a STRFAXSPT *ALL since IBM didn't have
that option in the first parameter on the STRFAXSPT command.

Attachments don't usually go to the list so I also posted the code at:
http://code.midrange.com/a68c3b54fc.html

/* Start all fax devices. */
/* Adds *ALL as an option in FAXD on the STRFAXSPT command. */
/* */
/* No rights reserved at all. Feel free to modify code and comments as */
/* desired. */
/* Thanks to Guy Vig of IBM for assistance with handling pointers in CL */
/* For information on handling Application Program Interfaces or APIs +
please see the Infocenter at: +
http://publib.boulder.ibm.com/iseries/ +
Studying: +
- API concepts +
- QUSPTRUS - Retrieve pointer to userspace +
- QUSCRTUS - Create user space +
- QUSMBRL - List Members +
Or buy the book by the former IBMer Bruce Vining +
"IBM System i APIs at Work" available at http://store.midrange.com */

/* Modification log: */
/* 08/21/08 by R.Berendt */
/* Created */
/* */
/* */
PGM

DCL &UserSpace *CHAR 20 /* Qualified user space */
DCL &SpaceObj *CHAR 10 STG(*DEFINED) DEFVAR(&UserSpace 1)
DCL &SpaceLib *CHAR 10 STG(*DEFINED) DEFVAR(&UserSpace 11)
DCL &USExtAttr *CHAR 10 VALUE('MEMBERLIST') /* Extended Attr of
userspace */
DCL &USSize *INT 4 VALUE(0001) /* Initial size of user space
*/
DCL &USInit *CHAR 1 VALUE(X'00') /* Initial value of user space
*/
DCL &USAuth *CHAR 10 VALUE('*ALL') /* Public authority of user
space */
DCL &USText *CHAR 50 VALUE('QUSLMBR') /* Text of user space */
DCL &Format *CHAR 8 VALUE('MBRL0100')
DCL &DataBase *CHAR 20 /* Qualified database name */
DCL &DBObj *CHAR 10 STG(*DEFINED) DEFVAR(&DataBase 1)
DCL &DBLib *CHAR 10 STG(*DEFINED) DEFVAR(&DataBase 11)
DCL &MbrSelect *CHAR 10 VALUE('*ALL') /* Which members to retrieve
info */
DCL &Overrides *CHAR 1 VALUE('0') /* No override processing */
DCL &USPtr *PTR /* Pointer to user space */
DCL &GHPtr *PTR /* Pointer to generic header information
*/
DCL &GHInfo *CHAR 256 STG(*BASED) BASPTR(&GHPtr) /* Generic header
information */
DCL &GHHOffset *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 117) /* offset
to header */
DCL &GHHSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 121) /* header
size */
DCL &GHLOffset *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 125) /* offset
to list */
DCL &GHLSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 129) /* list
size */
DCL &GHLNbr *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 133) /* Number
of list entries */
DCL &GHLEntSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 137) /* Size of
each entry */
DCL &pListEntry *PTR /* Pointer to list entry. */
DCL &ListEntry *CHAR 10 STG(*BASED) BASPTR(&pListEntry) /* Current
fax configuration */
DCL &EntryNbr *INT 4 /* DOFOR VAR(&ENTRYNBR) FROM(1) TO(&GHLNBR)
*/
DCL &EnhSrv *CHAR 4 VALUE('*YES') /* Initially flag Enhanced
services to start */
DCL &FAXD *CHAR 220 VALUE(X'00') /* List of fax devices */
DCL &Cmd *CHAR 512 VALUE(X'00') /* Command to execute */
DCL &CmdLen *DEC (15 5) VALUE(512) /* Length of command to execute
*/

/* Create a user space to hold the list of members holding the fax
devices */
CHGVAR &SpaceObj 'QFAXDEV'
CHGVAR &SpaceLib 'QTEMP'
CALL QUSCRTUS PARM(&UserSpace &USExtAttr &USSize &USInit &USAuth &USText)
/* MONMSG CPF9870 User space already exists */

CHGVAR &DBObj 'QAFFCFG'
CHGVAR &DBLib 'QUSRSYS'
CALL QUSLMBR PARM(&UserSpace &Format &DataBase &MbrSelect &Overrides)
/* For debugging purposes only +
DSPF '/QSYS.LIB/QTEMP.LIB/QFAXDEV.USRSPC' +
*/

/* Retrieve pointer to user space */
CALL QUSPTRUS PARM(&UserSpace &USPtr)

/* Header information */
CHGVAR &GHPtr &USPtr

/* Any list entries? ie: Are there any fax devices at all? */
if (&GHLNbr>0) Then(Do)

/* Initialize pListEntry to some valid entry to allow the %offset to
work shortly */
chgvar &pListEntry &USPtr

DOFOR VAR(&EntryNbr) FROM(1) TO(&GHLNbr)
CHGVAR VAR(%offset(&pListEntry)) +
VALUE(%offset(&USPtr) + &GHLOffset +
+ ((&EntryNbr - 1) * &GHLEntSize))
IF (&EntryNbr = 1) then(do)
CHGVAR VAR(&FAXD) VALUE(&ListEntry)
EndDo
Else Do
CHGVAR VAR(&FAXD) VALUE(&FAXD *BCAT &ListEntry)
EndDo
EndDo /* Cycling through each list entry */
/* Using QCMDEXC because, if you have more than one fax device you'll
get +
STRFAXSPT FAXD('FAXD01 FAXD02')... +
while it should be +
STRFAXSPT FAXD(FAXD01 FAXD02) ... */
CHGVAR VAR(&Cmd) VALUE('STRFAXSPT FAXD(' *TCAT &FAXD *TCAT ') ENHSRV('
+
*TCAT &EnhSrv *TCAT ')')
CALL QCMDEXC PARM(&Cmd &CmdLen)

EndDo /* At least one list entry */

CleanUp:

/* Delete user space when done */
DLTUSRSPC USRSPC(&SPACELIB/&SPACEOBJ)

END:

ENDPGM



Rob Berendt
/* Start all fax devices. */
/* Adds *ALL as an option in FAXD on the STRFAXSPT command. */
/* */
/* No rights reserved at all. Feel free to modify code and comments as */
/* desired. */
/* Thanks to Guy Vig of IBM for assistance with handling pointers in CL */
/* For information on handling Application Program Interfaces or APIs +
please see the Infocenter at: +
http://publib.boulder.ibm.com/iseries/ +
Studying: +
- API concepts +
- QUSPTRUS - Retrieve pointer to userspace +
- QUSCRTUS - Create user space +
- QUSMBRL - List Members +
Or buy the book by the former IBMer Bruce Vining +
"IBM System i APIs at Work" available at http://store.midrange.com */

/* Modification log: */
/* 08/21/08 by R.Berendt */
/* Created */
/* */
/* */
PGM

DCL &UserSpace *CHAR 20 /* Qualified user space */
DCL &SpaceObj *CHAR 10 STG(*DEFINED) DEFVAR(&UserSpace 1)
DCL &SpaceLib *CHAR 10 STG(*DEFINED) DEFVAR(&UserSpace 11)
DCL &USExtAttr *CHAR 10 VALUE('MEMBERLIST') /* Extended Attr of userspace */
DCL &USSize *INT 4 VALUE(0001) /* Initial size of user space */
DCL &USInit *CHAR 1 VALUE(X'00') /* Initial value of user space */
DCL &USAuth *CHAR 10 VALUE('*ALL') /* Public authority of user space */
DCL &USText *CHAR 50 VALUE('QUSLMBR') /* Text of user space */
DCL &Format *CHAR 8 VALUE('MBRL0100')
DCL &DataBase *CHAR 20 /* Qualified database name */
DCL &DBObj *CHAR 10 STG(*DEFINED) DEFVAR(&DataBase 1)
DCL &DBLib *CHAR 10 STG(*DEFINED) DEFVAR(&DataBase 11)
DCL &MbrSelect *CHAR 10 VALUE('*ALL') /* Which members to retrieve info */
DCL &Overrides *CHAR 1 VALUE('0') /* No override processing */
DCL &USPtr *PTR /* Pointer to user space */
DCL &GHPtr *PTR /* Pointer to generic header information */
DCL &GHInfo *CHAR 256 STG(*BASED) BASPTR(&GHPtr) /* Generic header information */
DCL &GHHOffset *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 117) /* offset to header */
DCL &GHHSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 121) /* header size */
DCL &GHLOffset *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 125) /* offset to list */
DCL &GHLSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 129) /* list size */
DCL &GHLNbr *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 133) /* Number of list entries */
DCL &GHLEntSize *INT 4 STG(*DEFINED) DEFVAR(&GHInfo 137) /* Size of each entry */
DCL &pListEntry *PTR /* Pointer to list entry. */
DCL &ListEntry *CHAR 10 STG(*BASED) BASPTR(&pListEntry) /* Current fax configuration */
DCL &EntryNbr *INT 4 /* DOFOR VAR(&ENTRYNBR) FROM(1) TO(&GHLNBR) */
DCL &EnhSrv *CHAR 4 VALUE('*YES') /* Initially flag Enhanced services to start */
DCL &FAXD *CHAR 220 VALUE(X'00') /* List of fax devices */
DCL &Cmd *CHAR 512 VALUE(X'00') /* Command to execute */
DCL &CmdLen *DEC (15 5) VALUE(512) /* Length of command to execute */

/* Create a user space to hold the list of members holding the fax devices */
CHGVAR &SpaceObj 'QFAXDEV'
CHGVAR &SpaceLib 'QTEMP'
CALL QUSCRTUS PARM(&UserSpace &USExtAttr &USSize &USInit &USAuth &USText)
/* MONMSG CPF9870 User space already exists */

CHGVAR &DBObj 'QAFFCFG'
CHGVAR &DBLib 'QUSRSYS'
CALL QUSLMBR PARM(&UserSpace &Format &DataBase &MbrSelect &Overrides)
/* For debugging purposes only +
DSPF '/QSYS.LIB/QTEMP.LIB/QFAXDEV.USRSPC' +
*/

/* Retrieve pointer to user space */
CALL QUSPTRUS PARM(&UserSpace &USPtr)

/* Header information */
CHGVAR &GHPtr &USPtr

/* Any list entries? ie: Are there any fax devices at all? */
if (&GHLNbr>0) Then(Do)

/* Initialize pListEntry to some valid entry to allow the %offset to work shortly */
chgvar &pListEntry &USPtr

DOFOR VAR(&EntryNbr) FROM(1) TO(&GHLNbr)
CHGVAR VAR(%offset(&pListEntry)) +
VALUE(%offset(&USPtr) + &GHLOffset +
+ ((&EntryNbr - 1) * &GHLEntSize))
IF (&EntryNbr = 1) then(do)
CHGVAR VAR(&FAXD) VALUE(&ListEntry)
EndDo
Else Do
CHGVAR VAR(&FAXD) VALUE(&FAXD *BCAT &ListEntry)
EndDo
EndDo /* Cycling through each list entry */
/* Using QCMDEXC because, if you have more than one fax device you'll get +
STRFAXSPT FAXD('FAXD01 FAXD02')... +
while it should be +
STRFAXSPT FAXD(FAXD01 FAXD02) ... */
CHGVAR VAR(&Cmd) VALUE('STRFAXSPT FAXD(' *TCAT &FAXD *TCAT ') ENHSRV(' +
*TCAT &EnhSrv *TCAT ')')
CALL QCMDEXC PARM(&Cmd &CmdLen)

EndDo /* At least one list entry */

CleanUp:

/* Delete user space when done */
DLTUSRSPC USRSPC(&SPACELIB/&SPACEOBJ)

END:

ENDPGM

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.