LWKDIR (Assist to Set-up Working Dir. and Process Parameters, etc.)


PREMSG, PROMPT, DPCENT, ABEND, ABENDM,
OPNPIN, CLSPIN, LWKDIR, LRTRIM,
PARMIN, GPARMA, GPARMI, GPARMF, GPARMD,
GPARMIF, GPARMID, GPARMI2, GPARMF2, GPARMD2
NAME
    premsg / prompt - Output message to screen with/without NewLine
    dpcent - Display the progress of loop operation.
    abend  - Error exit with "ERROR n" output to <stderr>
    abendm - Error exit with "[ABEND] message" output to <stderr>
    opnpin / clspin - Provide a chance to select predefined data file 
                      as a data source for reading process parameters
    lwkdir - Display HOME (~) and CURRENT (.) directory paths, prompt and wait
             for specifying Working Directory Path, and then dispay absolute
             path name of that directory and filename list in it.
             The absolute pathname of the directory is returned as a string
             (with trailing '/'), which can be used to specify absolute
             filename simply by appending short filename.
         Here the "Working Directory" does not mean the change of Current
         Working Directory environment, but offers the easier way of
         specifying absolute path to target file.
    lrtrim - Get character length of a string trimmed off right spaces
    parmin / gparma / gparmi / gparmf / gparmd
     / gparmif / gparmid / gparmi2 / gparmf2 / gparmd2
           - Output prompt message and read process parameter(s) 

SYNOPSIS

      call premsg(mesg) 
      call prompt(mesg)
  mesg  [char]  Message string to output
          Output message to screen ("stderr" output) with NewLine ("premsg")
          or without NewLine ("prompt")

      call dpcent(m, n)
  n     [int]   Total number of loops.
  m     [int]   Number of loops executed already.
          At the first call, give m=0, n=0 to initialize.
          Then call it each time m=1,2,...,n (n>0).

      call abend(icd)
  icd   [int]   Code number to be output to <stderr>
      call abendm(msg)
  msg   [char]  Message text to be output to <stderr>

      call opnpin()
          Give a chance to select predefined data file for parameter input.
          If NULL string is specified, process parameters are read from 
          Keyboard as usual.  This mechanism is effective for "lwkdir" 
          function and "parmin/gparm?i/gparm??" routines until "clspin" 
          is called.
      call clspin()
          Finalize the "opnpin" mechanism.

      nch = lwkdir(len, dnm)
  len   [int]   Maximum length of string variable 'dnm'.
  dnm   [char]  String variable to return the absolute pathname of Working
                Directory.  (must be of size 'len' or more)
  nch   [int]   Number of characters returned in 'dnm'

          The string returned in 'dnm' is in the form of C language string
          having a trailing NULL (char(0)) character.
          If the length of path string of specified working directory is equal
          to or higher than 'len', the process is terminated abnomally with
          an error message output.

          If the length of path string of HOME (~), CURRENT (.), or Working
          Directory is higher than 120, the process is terminated abnomally
          with an error message output.

      nc = lrtrim(chrs)
  chrs  [char]  String to be processed
  nc    [int]   Character length after trimming right spaces for "chrs"

      call parmin(str, lbuf, buf)
  str   [char]   Prompt message string
  lbuf  [int]    Maximum size (in bytes) to input to buf
  buf   [char]   Raw input string
          Output prompt message and input raw string under "opnpin" control.

      call gparma(str, lnam, nam)
      call gparmi(str, iv)
      call gparmf(str, fv)
      call gparmd(str, dv)
      call gparmif(str, iv, fv)
      call gparmid(str, iv, dv)
      call gparmi2(str, iv, jv)
      call gparmf2(str, fv, gv)
      call gparmd2(str, dv, ev)
  str   [char]   Prompt message string
  lnam  [int]    Maximum size (in bytes) to input to nam
  nam   [char]   String parameter without in-between white space is given.
  iv,jv [int]    Integer value parameter is given.
  fv,gv [float]  Floating value parameter is given.
  dv,ev [double] Double floating value parameter is given.
          Output prompt message and read parameter(s) under "opnpin" control.

EXAMPLE
      character wdr*80, fnam*120
c
      call premsg('--- start ---')
      call opnpin()
      ldr = lwkdir(80,wdr) + 1
      fnam = wdr
      call gparma('Enter filename ==> ', 121-ldr, fnam(ldr:120))
      open(10,file=fnam,status='old')
      write(6,'(a,a)') 'Input file : ', fnam(1:lrtrim(fnam))
          :
          :
      call clspin()
      call prompt('Loop operation - ')
      call dpcent(0, 0)
      do 10 i=1,imax
      do 10 j=1,jmax
          :
          :
        call dpcent((i-1)*jmax+j, imax*jmax)
   10 continue
          :
          :
      if (.....) call abend(90)
          :
          :