home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / SREFPRC1 / WRTESTAT.SRF < prev   
Text File  |  1996-11-20  |  1KB  |  47 lines

  1. /* add a variable to the thread specific cache */
  2.  
  3. sref_write_state:
  4. parse arg a_var,a_value,athread,usefile
  5.  
  6. usefile=strip(usefile)
  7. athread=strip(athread)
  8. a_var=strip(upper(strip(a_var)),'t',':')
  9.  
  10. if pos(' ',a_var)>0 | a_var="" then return 0
  11.  
  12. nonh="SEL REQUEST SOURCE THREAD DATE_TIME SERVER_NAME "
  13. nonh=nonh||" CLIENT CLIENT_NAME CLIENT_PORT SERVER  SERVER_PORT TRANSACTION  !FUNGUS  "
  14.  
  15. /* no writing of reserved words */
  16. if wordpos(a_var,nonh)>0 then return 0
  17.  
  18. fooport=extract('serverport')
  19. enmadd='SREF_'||fooport||'_'
  20. ard=value(enmadd||'TEMPDATA_DIR',,'os2environment')
  21. ard=strip(ard,'t','\')||'\'
  22.  
  23. if athread="" then 
  24.   mytid=dostid()
  25. else 
  26.    mytid=athread
  27.  
  28. if usefile=' ' then
  29.    getfil=ard||'_T'||mytid||'.'||fooport
  30. else
  31.    getfil=usefile
  32.  
  33. aa=stream(getfil,'c','query exists')
  34. if aa="" then return 0
  35.  
  36.  
  37.  
  38. wow=cvread(getfil,dastuff)
  39. if wow=0 then return 0
  40.  
  41. dastuff.a_var=a_value
  42. wow=cvwrite(getfil,dastuff)
  43.  
  44.  
  45. return wow              /* 1=success, 0=failure */
  46.  
  47.