Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
When I modify a program or write a new program, I have gotten into the habit of moving the *ENTRY PLIST to a PI. Normally I don't have a care whether the program is compiled as a OPM or ILE unless I am adding procedure calls to it.
So I have here a little utility program which accepts some parms (from a CMD interface) and does some operations to a file. The parms are defined in a PI, and the program is entirely standalone (no external procedures required), so I originally created it as an OPM. Now many months later I need to alter a couple of lines of code (change some calculations), and the program will not compile:
001300 d USSTLLDPR3 pi *RNF0203 30 THE PROCEDURE CANNOT BE DEFINED WITH DFTACTGRP(*YES). 001400 d InstDate 7s 0
Now the EXTPGM function cannot be added to a PI, and we're at V7.1 so I do not need a PR, though I doubt adding a PR will help. (note - apparently adding the PR does allow it to compile - WTF?!)
So what's IBM's plan here - force me to go back in time and add the PR's for *ENTRY PLISTs defined as PI's, or when compiling main application programs change them to DFTACTGRP(*NO) and risk various overrides and openscopes not working as expected???
You have a cycle-main (no MAIN keyword)? Looking at current version of 7.1 ILE RPG Ref, Ch. 3, section titled Cycle Module. Reads to me like your PI needs an EXTPROC if the prototype is not specified.
Neil,
You've always had to use DFTACTGRP(*NO) anytime a Procedure call is in your RPG IV program source. Always been that way. Nothing has changed.
In v7.1 the did remove the requirement for Prototypes for in-line subprocedures, but that's all. If you do use MAIN (which Dale suggested) you still need the Prototype. Although IBM has shown the EXTPGM keyword on the PI line, in practice, I've never been able to get that to work. But I don't think that's your issue.
Perhaps your CRTBNDRPG command had DFTACTGRP(*NO) specified as its default?
Oh, and here's how I handle this issue in my code:
/IF DEFINED(*CRTBNDRPG) H DFTACTGRP(*NO) ACTGRP(*NEW) FIXNBR(*ZONED:*INPUTPACKED) /ENDIF
I know how to handle the problem guys, it's just disconcerting when a program you've compiled many times over suddenly doesn't compile due to a change in the compile and not the code.
h option(*nodebugio : *srcstmt) h copyright('CORPORATION WHAT I WORK FOR') ************************************************************* * * Program: USSTLLDPR * Author: Neilrh * Date: 04/19/2011 * De!--script--ion: * This program loads pricing for a customer into a price file. * ************************************************************* * *entry parameters d USSTLLDPR3 pi d InstDate 7s 0 d SndMsg pr extpgm('QMHSNDPM') d MsgId 7a const d MsgfName 20a const d MsgDta 128a const d MsgDtaLen 10i 0 const d MsgType 10a const d MsgQ 10a const d MsgQNbr 10i 0 const d MsgKey 4a d Error likeds(APIErr)
This has compiled many times as an OPM program, it doesn't need to be ILE, the only external stuff I'm doing is sending messages using IBM API. Today it does not compile without one of the following actions:
I wasn't suggesting; I was asking. Code shows no MAIN, so cycle-main is implied.
Neil,
This is NOT a change in the compiler. Did you guys upgrade and have your compiler defaults reset?
USSTLLDPR3 is a PI. Hence it is a subprocedure that you probably call. That has ALWAYS required DFTACTGRP(*NO).
We've installed cumulative PTF packages, but we haven't reset anything. The code as listed has compiled many times under V7.1 as an OPM program, now it looks like this:
* *entry parameters d USSTLLDPR3 pr extpgm('USSTLLDPR3') d InstDate 7s 0 d USSTLLDPR3 pi d InstDate 7s 0
Are you trying to add the EXTPGM keyword to the PI using SEU? If so, SEU will complain about that because it is frozen at 6.1 and doesn't understand the 7.1 enhancements. If you ignore the error, it should compile OK (I just tried it), but that's a pain in the ***.
No extpgm does not work on PI, even in RDp, extproc does work, but this isn't an external procedure. My complaint is that a program I have been compiling for over a year, now won't compile unless I add a PR with EXTPGM or change it to an ILE compile.
Hmmm, but maybe I'll try add the EXTPGM anyway and see if that works.
Huh! Well that actually works - so, the EXTPGM on a PI is required now for an OPM programs *entry parameters, even when your source editor complains about it.
have you worn out the punch cards compiling it so often
(some old timers on the forum will know exactly what I am talking about, the rest won't have the foggest idea). You see if you compiled a deck of cards (punch cards) over and over, you could depending on the reader, etc. begin to wear the cards a bit, causing misfeeds, etc.
Neil,
Did you watch my RPG Report video on this topic?
Jump to 7:25 in the video and you'll see that EXTPGM is required on v7r1 on the PI statement for program Entry/PList parameters.
I think we discussed this in the class earlier this year, at that time the EXTPGM was required on the PI, but the compiler thought it was optional. You said at the time it was good practice to get into in case they corrected the compiler - this program was written over a year ago, before we had the discussion, and well before IBM matched the compiler requirements to the documentation.