• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

How to use RxQueue and textmode apps/commands etc.

Started by jep, 2008.04.22, 13:29:25

Previous topic - Next topic

jep

Marked as: Normal
Hello,

A little example how to queue output from commands and text mode applications to capture data and place in varaibles for futher use.

/* Check ( and Change ) CodePage */
'@ECHO OFF'

'@RXQUEUE /CLEAR' /* Remove data in queue! */

'@CHCP' /* Show output as CHCP display it */
SAY ''

'@CHCP | RXQUEUE' /* Run once more and place output in rexx queue */
PARSE VALUE LINEIN( 'QUEUE:' ) WITH .':' curr_cp /* Read first line from queue */
PARSE VALUE LINEIN( 'QUEUE:' ) WITH .':' prep_cp.1 ';' prep_cp.2 /* Read second line from queue */

SAY 'Current CodePage is: 'STRIP( curr_cp ) /* show found data available in first variable */
SAY 'Primary CodePage is: 'STRIP( prep_cp.1 ) /* show found data in second variable */

IF LENGTH( STRIP( prep_cp.2 ) ) > 0 THEN DO
   SAY 'Secondary CodePage is: 'STRIP( prep_cp.2 ) /* show found data in third variable */
   '@CHCP '||prep_cp.2 /* Change to alternative codepage */
   '@CHCP | RXQUEUE' /* Run once more and place output in rexx queue */
   PARSE VALUE LINEIN( 'QUEUE:' ) WITH .':' curr_cp /* Read line from queue */
   CALL LINEIN 'QUEUE:' /* Not interested in the result, we just want to take it from the queue */
   SAY ''
   SAY 'Current CodePage is now: '||STRIP( curr_cp ) /* show found data */
   '@CHCP '||prep_cp.1 /* Change back to original codepage */
   '@CHCP | RXQUEUE' /* Run once more and place output in rexx queue */
   PARSE VALUE LINEIN( 'QUEUE:' ) WITH .':' curr_cp /* Read line from queue */
   CALL LINEIN 'QUEUE:' /* Not interested in the result, we just want to take it from the queue */
   SAY ''
   SAY 'Current CodePage is now: '||STRIP( curr_cp ) /* show found data */
END