In the end this will be a procedure that takes in two parms:
chain to the order detail file find the order/counter
then write some information from this table into another
table. If an error occurs then set on the procedure
error indicator and end.
The start of the code (enough to compile)
OEHPRT
Now the copy book..
(makes it easier for other program to call - Ill show you later)
OEHPRT_CP
Create the module
How do I know if this is working
Write a test program and call it.
Compile it like this: (Then debug)
OEHPRTTST
I know .. Now your asking STILL How do I know this worked....
well lets change program OEHPRT to test this.
Now place in debug and you will see that the indicator in the calling program
will be set *on
- order number decimal 7,0
- order line number decimal 3,0 (I will call counter)
chain to the order detail file find the order/counter
then write some information from this table into another
table. If an error occurs then set on the procedure
error indicator and end.
The start of the code (enough to compile)
OEHPRT
PHP Code:
~
h nomain expropts(*resdecpos)
*=============================================================
* Program - OEHPRT
* Purpose - return error flag after writting OEHPRINT records
* using pro# & counter.
* Written - March 21st 2007
* Author - Jamie Flanary
* Program Description
* This program will return error flag after writting
* OEHPRINT records using pro# & counter.
* The OEHPRT_CP copy member should be used by programs that
* call this procedure to obtain the procedure prototype fields.
*
* InPronumber Dec 7 0 Input
* InCounter Dec 3 0 Input
* Outerror Char 1 Input/OutPut
*
* Indicator Usage
* None
*=============================================================
* This copy book is in my source file just for testing
* I would recommend creating a seperate source file for
* your procedures and copy books. Maybe QPRCSRC
/COPY SOURCE,OEHPRT_CP
****************************************************************
* Standalone Field Definitions *
****************************************************************
* Program message parameters
d errorind s n
* Beginning of procedure
P OEHPRT B EXPORT
* Procedure interface
d OEHPRT PI n
d InProNumber 7 0 VALUE
d InCounter 3 0 VALUE
/free
//--------------------------------------------------------
// MAIN PROGRAM
//--------------------------------------------------------
exsr Hskpg;
return errorind;
//--------------------------------------------
// Hskpg - one time run subroutine
//--------------------------------------------
begsr Hskpg;
endsr;
//--------------------------------------------
/end-free
* Endding of procedure
P OEHPRT E
(makes it easier for other program to call - Ill show you later)
OEHPRT_CP
PHP Code:
~
* OEHPRT_CP - Copy Member for procedure to write record to OEHPRINT
D oehprt PR n
D InProNumber 7 0 VALUE
D InCounter 3 0 VALUE
Create the module
PHP Code:
CRTRPGMOD MODULE(JAMIELIB/OEHPRT) SRCFILE(JAMIELIB/SOURCE)
Write a test program and call it.
Compile it like this: (Then debug)
PHP Code:
CRTRPGMOD MODULE(JAMIELIB/OEHPRTTST) SRCFILE(JAMIELIB/SOURCE)
Then:
crtpgm jamielib/oehprttst module(oehprttst oehprt)
PHP Code:
~
* Program message parameters
d OutCounter s 7 0
d OutProNumber s 3 0
d WriteError s n
/COPY SOURCE,OEHPRT_CP
/free
//--------------------------------------------------------
// MAIN PROGRAM
//--------------------------------------------------------
// Test the procedure if error then dont continue with code
if OEHPRT(OutProNumber : OuTCounter) = *Off;
// . . . . . . do more processing
else;
writeerror = *on;
endif;
*inlr = *on;
/end-free
well lets change program OEHPRT to test this.
PHP Code:
~
h nomain expropts(*resdecpos)
*=============================================================
* Program - OEHPRT
* Purpose - return error flag after writting OEHPRINT records
* using pro# & counter.
* Written - March 21st 2007
* Author - Jamie Flanary
* Program Description
* This program will return error flag after writting
* OEHPRINT records using pro# & counter.
* The OEHPRT_CP copy member should be used by programs that
* call this procedure to obtain the procedure prototype fields.
*
* InPronumber Dec 7 0 Input
* InCounter Dec 3 0 Input
* Outerror Char 1 Input/OutPut
*
* Indicator Usage
* None
*=============================================================
* This copy book is in my source file just for testing
* I would recommend creating a seperate source file for
* your procedures and copy books. Maybe QPRCSRC
/COPY SOURCE,OEHPRT_CP
****************************************************************
* Standalone Field Definitions *
****************************************************************
* Program message parameters
d errorind s n
* Beginning of procedure
P OEHPRT B EXPORT
* Procedure interface
d OEHPRT PI n
d InProNumber 7 0 VALUE
d InCounter 3 0 VALUE
/free
//--------------------------------------------------------
// MAIN PROGRAM
//--------------------------------------------------------
exsr Hskpg;
errorind = *on;
return errorind;
//--------------------------------------------
// Hskpg - one time run subroutine
//--------------------------------------------
begsr Hskpg;
endsr;
//--------------------------------------------
/end-free
* Endding of procedure
P OEHPRT E
will be set *on