/* Have dialog elements inside the driving REXX. The subroutine will write records between '>START name' and '>END' to a temporary pds as member 'name'. Any number of START / END blocks are allowed. The program will make one pass, extracting all data. The records should (obviously) be inside a comment block. Do not use data which can be confused with REXX comments. Parameters MAKE Create pds and do ALTLIB+LIBDEF for pds DROP Drop ALTLIB and LINDEFs, free pds DD(ddname) DDname for the DROP call. 2nd word of the resp from START. CHR(text) Use text as prefix for START and END tags. Default is '>'. Sample Parse value Inln2Pds('make chr(>>)') with cc i2ptext if cc<>0 then say 'Make rc' cc i2ptext else do address ispexec "display panel(pnl001)" if rc=0 then do address ispexec "ftopen temp" address ispexec "ftincl skl001" address ispexec "ftclose" end Parse value Inln2Pds('drop dd('i2ptext')') with cc text end /* dialog items block >>Start pnl001 )ATTR )Body expand(\\) %\ \Header line\ \+ %Cmd =>_zcmd \ \ + + Please enter member name_mbrname + )Init )Proc )End >>End >>Start skl001 )SET AST = * //&ast //L EXEC PGM=IEBGENER //SYSUT1 DD DISP=SHR,REN=SYS1.PARMLIB(&MBRNAME) >>End */ */ Inln2Pds: Procedure parse upper value arg(1), with what . 0 . 'DD('pdd')' . 0 . 'CHR('pchr')' . pchr=word(pchr '>',1) parse value 0 with ln name dd1 dd2 if what='MAKE' then signal Inln2PdsMake if what='DROP' then signal Inln2PdsDrop return '8 Invalid action' what Inln2PdsMake: cc=bpxwdyn('alloc rtddn(dd1) rtdsn(inlds1) new delete unit(vio)', 'lrecl(80) recfm(f,b) blksize(0) tracks space(4,4) dir(4)') if cc<>0 then return '8 alloc temp failed rc' cc Do n=1 to sourceline() s=sourceline(n) Select when translate(word(s,1))=pchr'START' then do parse value 0 s with ln . name . iterate end when translate(word(s,1))=pchr'END' then do if name='' then return '8 missing name' if dd2<>'' then p='dd('dd2')' else p='' cc=bpxwdyn('alloc rtddn(dd2)' p 'da('inlds1'('name')) shr reuse') if cc<>0 then return BpxWdyn('free dd('dd1')')+8, 'alloc mbr' name 'failed rc' cc "execio" ln "diskw" dd2 "(stem inl. finis)" end when name<>'' then do ln=ln+1 inl.ln=strip(s,'t') end otherwise nop End End "altlib act appl(exec) dd("dd1") uncond" if rc=0 then address ispexec "libdef ispplib library id("dd1") stack" if rc=0 then address ispexec "libdef ispplib library id("dd1") stack" if rc=0 then address ispexec "libdef ispslib library id("dd1") stack" if rc=0 then address ispexec "libdef isptlib library id("dd1") stack" cc=rc zz=bpxwdyn('free dd('dd2')') if cc<>0 then return '8 Altlib of libdef failed' return 0 dd1 /* get back with good rc and ddname */ Inln2PdsDrop: if pdd='' then return '8 Missing ddname' "altlib deact appl(exec)" address ispexec "libdef ispplib" address ispexec "libdef ispplib" address ispexec "libdef ispslib" address ispexec "libdef isptlib" return BpxWdyn('free dd('pdd')')