iSeries PDM CRTBNDRPG Parameters

75 pts.
Tags:
AS/400
CL
CRTBNDRPG
IBM iSeries
Programming
RPG
Hello The question is a bit long but the answer should be short so here it is. In order to run some pre/post-compile processing of RPG program I'm looking for a way of replacing QRN4CPP (CPP of CRTBNDRPG) with a CL program of my own that wil run Pre-Compile, Invoke the original QRN4CPP and then run Post-compile. I have a list of the CRTBNDRPG/CRTRPGMOD parameters (36 parameter) but not knowing the type and length of each parameter I fail to correctly get all of them in my CL program and pass them to the original QRN4CPP. (I only get the first 5 parameteres right, the rest are garbled). Can anyone refer me to a detailed parameter list (name, type, length) that PDM uses in invoking CRTBNDRPG/CRTRPGMOD? Thanks apriori Gad

Answer Wiki

Thanks. We'll let you know when a new response is added.

Is there a reason that you can’t simply create your own command and have your CPP invoke your precompiler, followed by invoking CRTBNDRPG, and then doing any post compile processing? In general the interface between the command and the CPP is not considered to be an application programming interface (API).

Discuss This Question: 11  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Gad
    Thanks, Yes, I believe there is a reason. I want my programmers to keep using the traditional PDM options 14/15 and be able to specify all compiling parameters they deem necessary - which means all of them. Options 14/15 invoke CRTBNDRPG/CRTRPGMOD CMDs. My own CMD would still need to pass all parameters to CRTBNDRPG so I guess I failed to understand your meaning. Gad
    75 pointsBadges:
    report
  • Gilly400
    Hi, You could try using the GENCMDDOC command, this gives you a HTML & XML documentation of a command :- GENCMDDOC CMD(CRTBNDRPG) GENOPT(*SERVICE) Will create HTML & XML documents on your IFS. If you look at the XML document you should see position and type of each parameter on the command. Hope this helps, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Gad
    Hi The GENCMDDOC CMD(CRTBNDRPG) GENOPT(*SERVICE) failed with CPF6E67 Java Virtual Machine is Classic. JVM properties were loaded from a properties file. GENOPT(*SERVICE) specified. Command documentation not generated for proxy command CRTBNDRPG in QSYS. 1 command documents failed; 0 command documents created successfully. I have produced the HTML document a few weeks ago. The parametrs are all there only the length and type are missing. I'll what I can do with the failing GENCMDDOC Thanks. Gad
    75 pointsBadges:
    report
  • bvining
    GENCMDDOC does not work with proxy commands. If you do a DSPCMD CRTBNDRPG you will see that the target command is QDEVTOOLS/CRTBNDRPG. GENCMDDOC will work with this command. I would still not recommend this though as you will be tying yourself to implementation details that may change from release to release. When I get a chance, hopefully later today, I'm going to try and see if the Command Analyzer exit support might not provide you with the capability you're looking for. Bruce Vining http://www.brucevining.com/
    6,485 pointsBadges:
    report
  • bvining
    I did sufficient testing of the Command Analyzer exit to suggest that this approach should work. i5/OS allows you to register exit programs which should be called whenever a command executes. In my test I registered the program CBREXIT to the CRTBNDRPG command using: ADDEXITPGM EXITPNT(QIBM_QCA_CHG_COMMAND) FORMAT(CHGC0100) PGMNBR(1) PGM(VINING/CBREXIT) PGMDTA(*JOB 20 'CRTBNDRPG QDEVTOOLS') This exit is documented here. When using option 14 off of the PDM Work with Members panel my exit program was called within the submitted job. When CBREXIT was called the Change allowed indicator was on indicating that my exit program could replace the command to be executed. In this case replacing CRTBNDRPG with my own command. When the exit program is called, all of the parameters for the CRTBNDRPG are also passed as the Command string field along with a Length of command string. I woud suggest defining your command with two parameters: a character variable into which the exit program will move the Command string for CRTBNDRPG and an integer variable into which the exit program will move the Length of command string for the CRTBNDRPG. The exit can then return. Command Analyzer will then run your command rather than the original CRTBNDRPG. Your CPP will do the pre-compiler work you want, use an API such as QCMDEXC or QCAPCMD to run the CRTBNDRPG command passed to it as parameter 1, and after the CRTBNDRPG command finishes do your post-compile work. The one consideration is that CBREXIT will be called again when your command issues the CRTBNDRPG. To avoid getting into a recursive loop your CPP might create a *DTAARA or somesuch in QTEMP and CBREXIT will check to see if the *DTAARA exists. If it does, then don't change the CRTBNDRPG to your command. This time through simply return from CBREXIT and the compiler will run. Using this approach you get to pass and use all of the parameters specified on the CRTBNDRPG but have no dependency on their layout, definition, sequence, etc. This Command Analyzer exit was intended by IBM to help users avoid having to reverse engineer IBM supplied commands. This reverse engineering is error prone, time consuming, and quite often necessary to redo on a release boundary. Developers have better things to do then continually reverse engineer a command to cpp interface. I hope this helps, Bruce Vining http://www.brucevining.com/
    6,485 pointsBadges:
    report
  • Gad
    Hello Bruce Thanks a lot! This surly is a more generic thus better way of doing it.. Regards Gad
    75 pointsBadges:
    report
  • Gad
    Hello Bruce Having acually running the Exit program I wrote for CRTBNDRPG I found that I'm getting some parameters that seems erronoues. Parameter Exit Point Name, Exit Point Format, CMD Name, CMD Lib, ALW Change Indicator, and Prompt Indicators seems OK , BUT prameters like offset to CMD string (which I get as zero) or CMD lengtht. The CRTBNDRPG command in the command string does not start at offser zero . Here is the Data Structure I use for Input parameters Do I err again? DInput ds D EXITp_Name 20A Exit Point Name D EXITp_FMT_Name 8A ExitPoint Formatname D CMD_Name 10A Command Name D Lib_Name 10A Library Name D ChgAlwInd 1A Change Allow Indicat D PromptInd 1A Prompt Indicator D Reserved 2A Reserved D CMD_Offset 4B 0 Offset to CMD String D CMD_Length 4B 0 Length of CMD String D PRX_Offset 4B 0 Offset to CMD Proxy D PRX_num 4B 0 Number of entries in proxy D CMD_String 3000A Command String
    75 pointsBadges:
    report
  • Gad
    Hello Bruce, Sorry, my mistake, the Binary fields should be 8B 0 instead of 4B 0 Thanks again - it's working GREAT. Gad
    75 pointsBadges:
    report
  • bvining
    Glad to hear it's working for you. I would like to add just a few things to this discussion though, just in case you use other APIs and/or exits in the future: 1. Rather than 8B, it's more typical to use 9B or 10i (with 10i being the preferred definition) for API Binary(4) fields 2. You didn't need to create your own data structure definition. In the API documentation there is the line 'QSYSINC Member Name: ECACHCMD'. What this is telling you is that in file QSYSINC/QRPGLESRC is a source member ECACHCMD. This source member defines the fixed fields of the CHGC0100 for you. You simply need to /copy it into your program, optionally define the variable length fields, and away you go. If you don't have the QSYSINC library on your system, you can install it from your i5/OS media. QSYSINC is option 13 of i5/OS Glad I was able to help, Bruce Vining http://www.brucevining.com/
    6,485 pointsBadges:
    report
  • Gad
    Thanks again for all the help. I still need your help with a small issue: As I said your method is working like a charm but the command I'm replace the CRTBNDRPG with (awkwardly called CRTRPG) is always prompting the user for the 2 parameters: The original CRTBNDRPG CMD and it's length although they are already in place so that the programmers is required to press Enter. I have not found a way to suppress the prompting! Can you Help? Regards Gad P.S in case you're curios about the function of this Pre/Post Processing I would like to explain that I use it In order to include in an RPG source all the data needed for it's compilation. I developed a method of inserting specially marked CMD/PGM lines in the RPG source combined with a pre/post-compile program that searches the source for those lines and executes the CMDs/PGMs prior to / after compilation. I use these CMDs to set the Library list, File Overrides, running OPNQRYFs etc. That way, all a programmer has to do is use PDM option 14 or 15 to compile the source. The pre-processing was easy, I specified the pre-processing program as a VCP for the CRTBNDRPG CMD. The Post-Compile proved to be harder and although I managed to evoke a batch job which used RUNJOBCMD to check the RETURNCODE data area of the compiling job and do the post processing, it involved changing a QALWJOBITP System Value I preferred not to and in addition it was not "Elegant" so I started asking around internet forums
    75 pointsBadges:
    report
  • Gad
    Hello Bruce False alarm - I have found the bug. The whole method is working FINE. Thanks again for all the trouble you took Much oblige (I Hope this slang phrase is still in use) Gad
    75 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following