0% found this document useful (0 votes)
131 views7 pages

Binding With Binder

Binder language defines exports for a service program and is stored in a source file member associated with the service program. It provides control over exporting subprocedures, fields, and data structures. The binder language source consists of STRPGMEXP, EXPORT, and ENDPGMEXP commands and defines export groups and signatures to control binding.

Uploaded by

harias400
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views7 pages

Binding With Binder

Binder language defines exports for a service program and is stored in a source file member associated with the service program. It provides control over exporting subprocedures, fields, and data structures. The binder language source consists of STRPGMEXP, EXPORT, and ENDPGMEXP commands and defines export groups and signatures to control binding.

Uploaded by

harias400
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Binding with Binder Language with Bob Cozzi Binder Language is A small set of commands that define the

e exports for a service program. Stored in source file members Associated with a service program on the CRTSRVPGM command Provides a high-level of control over exporting Subprocedures Fields, arrays data structures (aka variables)Binder Language and Binding Directories Binder language and Binding Directories have nothing in common The letters Bind are all they have in common They have nothing to do with one another What is a Signature? Generated when *SRVPGM is created Uses the order of exported variables and subprocedures to generate the signature If the order or number of procedures changes, (on a recompile) the signature changes Binding language lets you control the export

order and items that are exported Thus giving you control over the signatureSignature and Level Checking? Yes, Signatures may have a level check flag. LVLCHK(*YES) means, check the service programs signature against that used when the *PGM was compiled. If the signature is different, you get a signature violation. LVLCHK(*NO) means you really know what youre doing and theres not chance of an issue, or it means youre really dumb. Where to Use Binding Language On the EXPORT parameter of CRTSRVPGM By default EXPORT(*SRCFILE) Provides access to binding language Most people, however, use EXPORT(*ALL) Provides an all or nothing export solution All SubProcedures that have the EXPORT keyword are exportedThe CRTSRVPGM Command Default for the EXPORT ParameterEXPORT(*ALL) is Commonplace Default for the EXPORT ParameterCreating Binder Language Create a source file QSRVSRC Try to make the RCDLEN(112) vs the default Add a member for each bind/creation process Typically one set of binder language per

service program That is one QSRVSRC source member Binding Language is Source Consists of 3 CL Commands STRPGMEXP Start Program Export Group EXPORT Export a Procedure or Variable ENDPGMEXP End Program Export groupSTRPGMEXP Start Program Export Group PGMLVL Export Group Signature Level *CURRENT New compiles use this export group *PRV Existing compiled programs use this group LVLCHK Level check the signature *YES Runtime checking of the signature *NO No runtime signature checking SIGNATURE - Signature *GEN Automatically generate a signature YourSignature Custom signature EXPORT Export An Item SYMBOL Identifier to be exported Enclose the field or subprocedure name in quotes Make sure your RPG IV subprocedure and field names are in all UPPERCASE e.g., SYMBOL(MYSUBPROC) Not: SYMBOL(MySubProc)ENDPGMEXP End Export Group Ends the export group

Example Binder Language Exporting two subprocedures GETCUSTINFO Retrieve Customer Information GETCTRLNBR Retrieve Control Number STRPGMEXP PGMLVL(*CURRENT) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) ENDPGMEXPUpdating the Binder Language If you add exported subprocedures By adding more subprocedures to existing source members By adding more modules with new subprocedures If you add exported fields By adding the EXPORT keyword to global variables Updated Binder Language Add two new subprocedures SETTRNFEE Set Transaction Fee SETCTRLNBR Set Control Number STRPGMEXP PGMLVL(*CURRENT) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) EXPORT SYMBOL(SETTRNFEE) EXPORT SYMBOL(SETCTRLNBR) ENDPGMEXPUpdated Binder Language WRONG!

Whats wrong with this picture? We are adding to the existing *CURRENT export group Signature will change All existing programs that use this server program will blow up STRPGMEXP PGMLVL(*CURRENT) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) EXPORT SYMBOL(SETTRNFEE) EXPORT SYMBOL(SETCTRLNBR) ENDPGMEXP / Updating Signatures/Binder Source Two ways to modify binder source to avoid a new siguture Create a second set of exports Mark this second set as *PRV Make this second set the same as the old *CURRENT Keep the *CURRENT export list and add the new exports to it Hard code a signature and always make it *CURRENT Add new exports to the end of the export listUpdating Binder Language Second Set of EXPORTs

STRPGMEXP PGMLVL(*CURRENT) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) EXPORT SYMBOL(SETTRNFEE) EXPORT SYMBOL(SETCTRLNBR) ENDPGMEXP STRPGMEXP PGMLVL(*PRV) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) ENDPGMEXP Existing programs will link up with the *PRV signature Any new programs (i.e., any program compiled/recompiled) will link up with the *CURRENT signature Updating Binder Language Hard Coded Signature Old/existing program continue to use the same "hard coded" signature They continue to access the proper exports New programs also use the signature and can access the new exports as well as existing exports STRPGMEXP PGMLVL(*CURRENT) SIGNATURE(MYSRVPGM) EXPORT SYMBOL(GETCUSTINFO)

EXPORT SYMBOL(GETCTRLNBR) EXPORT SYMBOL(SETTRNFEE) EXPORT SYMBOL(SETCTRLNBR) EXPORT SYMBOL(GETCUSTINFO) EXPORT SYMBOL(GETCTRLNBR) ENDPGMEXPRTVBNDSRC Retrieve Binder Source Helper command that generates binder source Generates Binder Source from existing objects *MODULEs or *SRVPGMs Generic names are supported Stores the binder source in a source member Inserts comments into the source Identifies the origin of the exported variable or procedure name Good to use this once per service program To get the binder language started

You might also like