Code:
- 0001.00 h option(*srcstmt : *nounref : *nodebugio )
- 0003.00
- 0005.00 *--------------------------------------------------
- 0006.00 * Program: TestStuff
- 0007.00 *
- 0008.00 * Notes: stub testing: LOCKS module
- 0009.00 * No SQL needed in this test, but the production caller
- 0009.01 * will have, so this module is compiled with CRTSQLRPGI.
- 0010.00 *--------------------------------------------------
- 0013.00
- 0014.00 * Program Prototype (*Entry parms)
- 0015.00 d TESTSTUFF PR EXTPGM('TESTSTUFF')
- 0017.00 d TESTSTUFF PI
- 0018.00
- 0019.00 _____ * Private subprocedures
- 0020.00 vvvvv *
- 0021.00 * (none)
- 0022.00 ^^^^^ *
-
- 0023.00 _____ * Global definitions
- 0024.00
- 0025.00 ____
- 0026.00 vvvvv * Called functions and procedure
- 0024.00 * Generic Service Order Lock management using SVLOCK file.
- 0025.00 D ManageLocks...
- 0026.00 D PR Extproc('LOCKS')
- 0027.00 D likeds(SOlocks_ds)
- 0028.00 D Action 6a const
- 0029.00 D Order 6a const options(*nopass)
- 0031.00
- 0032.00 * Data returned from ManageLocks
- 0033.00 d SOlocks_ds...
- 0034.00 d DS qualified
- 0035.00 d Locked n
- 0036.00 d MessageText 128a varying
- 0031.00 ^^^^^ *
- 0032.00 ____
- 0033.00 * Global variables, constants, arrays
- 0034.00 d DisplayThis s 52a
- 0035.00
- 0036.00 * mnemonic constants
- 0037.00 d FALSE c const('0')
- 0038.00 d NO c const('0')
- 0039.00 d TRUE c const('1')
- 0040.00 d YES c const('1')
- 0041.00 d error c const('[error]')
- 0042.00 d out c const('O')
- 0043.00 ^^^^^ *
- 0044.00
- 0045.00 _____ * Begin Mainline Logic
- 0046.00 /free
- 0047.00 // set standard sql options.
- 0048.00 exec sql
- 0049.00 set option closqlcsr = *endmod,
- 0050.00 commit = *none,
- 0051.00 datfmt = *iso;
- 0050.00 commit = *none,
- 0051.00 datfmt = *iso;
- 0052.00
- 0053.00 vvvvv // ~~~~~~~~~~~~~~~~THE STUFF TO TEST GOES BETWEEN HERE... ~~~~~~~~~~~~~~~
- 0054.00 // testing LOCKS
- 0055.00 SOlocks_ds = ManageLocks('LOCKIT' : '096659');
- 0056.00 if %len(SOlocks_ds.MessageText) > 52;
- 0057.00 DisplayThis = %subst(SOlocks_ds.MessageText : 1 : 52);
- 0058.00 else;
- 0059.00 DisplayThis = SOlocks_ds.MessageText;
- 0060.00 endif;
- 0061.00 DSPLY (DisplayThis);
- 0062.00
- 0063.00 if SOlocks_ds.Locked;
- 0064.00 SOlocks_ds = ManageLocks('UNLOCK' : '096659');
- 0065.00 if %len(SOlocks_ds.MessageText) > 52;
- 0066.00 DisplayThis = %subst(SOlocks_ds.MessageText : 1 : 52);
- 0067.00 else;
- 0068.00 DisplayThis = SOlocks_ds.MessageText;
- 0069.00 endif;
- 0070.00 DSPLY (DisplayThis);
- 0071.00 endif;
- 0072.00
- 0073.00 if not SOlocks_ds.Locked;
- 0074.00 SOlocks_ds = ManageLocks('CLOSE');
- 0075.00 if %len(SOlocks_ds.MessageText) > 52;
- 0076.00 DisplayThis = %subst(SOlocks_ds.MessageText : 1 : 52);
- 0077.00 else;
- 0078.00 DisplayThis = SOlocks_ds.MessageText;
- 0079.00 endif;
- 0080.00 DSPLY (DisplayThis);
- 0081.00 endif;
- 0082.00 ^^^^^ // ~~~~~~~~~~~~~~~~ ... and HERE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 0083.00 *inLR = *ON;
- 0084.00 return;
- 0085.00 /end-free
-
|
|