|
Here is all related code: * Printer File FCUTPO120 O E PRINTER OFLIND(*IN40) USROPN C ExSr $Init C Read CUPPO120 C DoW Not %Eof(CUPPO120) C ExSr $SetOverlay C Open CUTPO120 ........ C Write POFOOT C Close CUTPO120 C Read CUPPO120 C EndDo C $SetOverlay BegSr C If %SubSt(DPCRLCTN:1:2) = '11' * Bill to is Taylor even though the ship to is different C Call 'CUCPO120OV' C Parm '0011' Cmpny 4 C Else C Move DPCRCMPNY Cmpny 4 * Bill to the company C Call 'CUCPO120OV' C Parm Cmpny C EndIf C EndSr ... and the CL program PGM PARM(&CMPNY) DCL VAR(&CMPNY) TYPE(*CHAR) LEN(4) DCL VAR(&OVRLYNAME) TYPE(*CHAR) LEN(6) CHGVAR VAR(&OVRLYNAME) VALUE('CO' || &CMPNY) /* Remove the override */ DLTOVR FILE(*PRTF) MONMSG MSGID(CPF9841) /* Set the overlay */ OVRPRTF FILE(*PRTF) FRONTOVL(OVERLAYLIB/&OVRLYNAME) /* CHGSPLFA FILE(CUTPO120) SPLNBR(*LAST) SELECT(*ALL) + FRONTOVL(OVERLAYLIB/&OVRLYNAME) */ EXIT: ENDPGM -----Original Message----- From: Scott Klement [mailto:klemscot@klements.com] Sent: Wednesday, May 15, 2002 12:43 PM To: 'rpg400-l@midrange.com' Subject: RE: Running a command midjob not working. Are you calling the CL program from the same RPG that creates the spool file? If so, you have to take activation group and/or call-level into account, since the CL program runs at a later call level, call-level overrides will be a problem. If the CL does not use the same activation group, then that will be a problem. I generally use QCMDEXC for this type of thing because I don't like dealing with the actgrp/call-level problem. To me, QCMDEXC is a LOT easier than calling a separate CL program. Also, you have to make sure that you do the override BEFORE opening the spool file. Therefore, if the override isn't in place before the RPG program starts up, you'll have to use a USROPN printer file, and the OPEN op-code, to control when the spool file gets opened. Overrides only affect things at the time that the program opens. My system doesn't have a CHGSPLF command. You must mean CHGSPLFA? That method should also work, as long as you manage to do it before the file is sent to the writer. Personally, I prefer the OVRPRTF approach. On Wed, 15 May 2002, Wills, Mike N. (TC) wrote: > > Oh... one additional thing. I am doing this by calling a CL program with a > parm. > > What we need to do is dynamically assign an overlay based upon criteria in a > file I read in my RPG program. I create different spool file for every > header record read in and each spool file can have a different overlay. I > have tried to do a 'OVRPRTF *PRTF' before every time I open a new spool file > and tried to do a CHGSPLF after every time I close the spoolfile (which > causes a MSGW), neither worked. What can I do to accomplish this? _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.