RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

QShell Program Print E-mail
User Rating: / 0
PoorBest 

Written by Chamara Withanachchi   
  * in QShell. 
  *                   Scott Klement 
  * 
  *  To compile: 
  *      - CRTBNDRPG SHELLP SRCFILE(xxx/xxx) DBGVIEW(*LIST) 
  * 
 H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('QC2LE') 
 
 D stdin           s               *   import('_C_IFS_stdin') 
 D stdout          s               *   import('_C_IFS_stdout') 
 D stderr          s               *   import('_C_IFS_stderr') 
 
 D fgets           PR              *   ExtProc('_C_IFS_fgets') 
 D   string                   65535a   options(*varsize) 
 D   size                        10I 0 value 
 D   stream                        *   value 
 
 D fputs           PR            10I 0 ExtProc('_C_IFS_fputs') 
 D   string                        *   value options(*string) 
 D   stream                        *   value 
 
 D CEETREC         PR 
 D   rc                          10I 0 const options(*omit) 
 D   user_rc                     10I 0 const options(*omit) 
 
 D LF              C                   x'25' 
 D msg             s             80a   varying 
 D inpbuf          s             80a 
 D sz              s               * 
 D name            s             80a   varying 
 
  /free 
 
   msg = 'Hello !' + LF 
          + 'Please enter your name:' + LF; 
   fputs(msg: stdout); 
 
   sz = fgets(inpbuf: %size(inpbuf): stdin); 
   if (sz <> *null and %len(%str(sz))>1); 
       name = %str(sz); 
       %len(name) = %len(name)-1; 
       msg = 'Hello ' + name + ', nice to meet you!' + LF; 
       fputs(msg: stdout); 
       CEETREC(*omit: 0); 
   else; 
       msg = 'Invalid name. Seek professional help.' + LF; 
       fputs(msg: stderr); 
       CEETREC(*omit: 1); 
   endif; 
 
   CEETREC(*omit: 0); 
 
   *inlr = *on; 
  /end-free 
User Comments

Please login or register to add comments

<Previous   Next>