-
QUSRSPLA API
Hallo Jürgen,
vielleicht hilft dies ?
Retrieve a Spool File
Number
Hey, Ted:
Is there a way to retrieve the number the system assigns to a spooled file? Some commands, such as the Copy Spooled File (CPYSPLF) command, allow me to use the special value *LAST to access the highest-numbered spooled file of a certain name. But if I could retrieve the spooled file number, I could do other good things, such as allow other jobs to retrieve and use the spooled file.
-- Moe
Sure, Moe. It's possible. Use the Retrieve Spooled File Attributes API, QUSRSPLA. It returns a data structure packed full of goodies, including the spooled file number.
The following CL program produces two reports, both of which are named QSYSPRT. That is, the RPG programs that produce these reports write to printer file QSYSPRT. After the first RPG program runs, the CL program retrieves the spooled file number. After the second RPG program runs, the CL submits program SPLF03C (given below) to batch, passing parameters containing the job information, spooled file name, and spooled file number. The batch job uses this information to retrieve the spooled file.
PGM
DCL &SPLFNBR *CHAR 4
DCL &WHICHSPLF *CHAR 4
DCL &RCVLEN *CHAR 4
DCL &RECEIVER *CHAR 80
DCL &JOBNAME *CHAR 10
DCL &JOBUSER *CHAR 10
DCL &JOBNBR *CHAR 6
/* Get identifying info for this job */
RTVJOBA JOB(&JOBNAME) USER(&JOBUSER) NBR(&JOBNBR)
/* Generate first report */
CALL PGM(RPGPGM1)
/* Get spool file number of report just produced */
CHGVAR VAR(%BIN(&WHICHSPLF)) VALUE(-1)
CHGVAR VAR(%BIN(&RCVLEN)) VALUE(80)
CALL PGM(QUSRSPLA) PARM(&RECEIVER &RCVLEN +
'SPLA0100' '*' ' ' ' ' QSYSPRT &WHICHSPLF)
CHGVAR VAR(&SPLFNBR) VALUE(%BIN(&RECEIVER 77 4))
/* Generate second report */
CALL PGM(RPGPGM2)
/* Tell another program about the first report */
SBMJOB CMD(CALL PGM(SPLF03C) PARM(&JOBNAME &JOBUSER +
&JOBNBR QSYSPRT &SPLFNBR)) JOB(THOLTTEST)
ENDPGM
Here's SPLF03C, the CL program that runs in batch and accesses the report generated in the other CL program:
PGM PARM(&JOBNAME &JOBUSER &JOBNBR &FILENAME +
&SPLFNBR)
DCL VAR(&SPLFNBR) TYPE(*CHAR) LEN(4)
DCL VAR(&FILENAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
CPYSPLF FILE(&FILENAME) TOFILE(SPOOLFILE) +
JOB(&JOBNBR/&JOBUSER/&JOBNAME) +
SPLNBR(&SPLFNBR) CTLCHAR(*PRTCTL)
ENDPGM
If there's a possibility that the spooled file won't be there, monitor for message CPF34C0. However, the best way to handle such a situation is to make sure that the Retrieve Spooled File Attributes (QUSRSPLA) API doesn't run if the report is not produced. To find out more about the QUSRSPLA API, visit the iSeries 400 Information Center. Click on the following topics in the navigation pane (located on the left side of the Web page):
Programming
CL and APIs
APIs
APIs by category
In the APIs by category list, choose the Print link. On the Print APIs page, click on the Spooled file APIs link. QUSRSPLA is the last API on the Spooled Files API page.
-- Ted
Gruss TARASIK
Similar Threads
-
By schatte in forum NEWSboard Programmierung
Antworten: 19
Letzter Beitrag: 10-01-07, 11:32
-
By Bratmaxxe in forum NEWSboard Programmierung
Antworten: 9
Letzter Beitrag: 08-01-07, 09:50
-
By Weki in forum NEWSboard Server Software
Antworten: 6
Letzter Beitrag: 29-08-06, 09:09
-
By M.Kasper in forum IBM i Hauptforum
Antworten: 6
Letzter Beitrag: 25-08-06, 07:32
-
By JonnyRico in forum NEWSboard Programmierung
Antworten: 14
Letzter Beitrag: 30-03-06, 12:33
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks