MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FILE Manager, batch and Rexx

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Wed Apr 05, 2023 9:34 am    Post subject: FILE Manager, batch and Rexx Reply with quote

I'll put this here so theoretically, other people can find this and not have to bang their heads against the wall as much as I did.
Basically (and I've appended along these lines before), I want to be able to run a batch FMI job for regression testing so that I can test creating records/segments in a IMS database and then, very simply, delete them all and test again. First of all, my JCL

Code:

//S030     EXEC PGM=FMN1IMSB                                       
//*                                                               
//STEPLIB  DD DSN=SYS1.SFMNMOD1,DISP=SHR                           
//*                                                               
//* THIS FILE CONTAINS THE FILE MANAGER COMMANDS WE WANT TO RUN.   
//* RECORDS STARTING WITH -- IN POS 1-2 ARE CONSIDERED COMMENTS AND
//* IGNORED                                                       
//* NOTE THAT THE DD-NAME MUST BE FMIBATCH                         
//*                                                               
//FMIBATCH DD DISP=SHR,DSN=&SYSUID..PROJ.DATA(DFFNYOFF)           
//*                                                               
//FMNREPT  DD SYSOUT=*,RECFM=FBA,LRECL=133                         
//*                                                               
//FMNPRINT DD SYSOUT=*,RECFM=FBA,LRECL=133                         
//*                                                               
//FMNRPRC  DD SYSOUT=*,RECFM=FBA,LRECL=133                         
//*                                                               
//FMIMSIN  DD  *                                                   
ÅÅFILEM SET HEADERPG=NO,PAGESIZE=60                               
ÅÅFILEM IEB REGNTYPE=DLI,                     
ÅÅFILEM     PSBTYPE=DYNAMIC,                   
ÅÅFILEM     DBDDSN=xxxx.IMS.DBDLIB,           
ÅÅFILEM     DBDMEM=DFFNYOFF,                   
ÅÅFILEM     IMSID=xxxx,                       
ÅÅFILEM     CRITERIA=N,                       
ÅÅFILEM     VIEW=N,                           
ÅÅFILEM     IMSOBA=80,                         
ÅÅFILEM     IMSNBA=50,                         
ÅÅFILEM     CHKPFREQ=1,        <---- without this, you might well see discrepancies in the results here and when you review the
                                                                             database using FMI 3270 after this job has run to completion                     
ÅÅFILEM     PROC=FMITEST                       
/*                                             
//FMNEXEC  DD DSN=&SYSUID..TEST.CLIST,DISP=SHR

then my Rexx code
Code:

/* Rexx **************************************************************
 This batch File Manager script can be used to perform various       
 steps on any DL/1 database                                           
                                                                     
 An example of this as JCL from my previous SEB stint can be found in
                   e:\shb\misi01.fman.jcl                             
                                                                     
*********************************************************************/
rname = 'FMITEST'                                                     
/* say 'Running 'rname   ; trace   a */                               
signal on novalue name sub_novalue                                   
/* NB NB NB NB                                                       
   You don't seem to be able to allocate any files within the Rexx   
   script, but you CAN allocate them in the JCL and use EXECIO to     
   read them, HOWEVER, the address MUST be MVS and NOT TSO           
*/                                                                   
address MVS "execio * diskr fmibatch (stem fmibatch. finis"           
say 'EXECIO rc 'rc' fmibatch.0 'fmibatch.0                           
                                                                     
do i = 1 to fmibatch.0                                               
                                                                     
  cmd  = subword(fmibatch.i, 1, 1)                                   
  temp = subword(fmibatch.i, 2)                                       
                                                                     
  select
                                                             
    when left(cmd, 2) = '--' then                   
      say 'Commented line on line 'i                 
                                                     
    when cmd = 'GETIMS' then                         
      do                                             
        say 'calling GETIMS with 'temp               
        filerc = GETIMS(temp)                       
        rc = show_ims_results()                     
        if filerc = 'EOF' then                       
          say 'Segment not found using GETIMS'       
      end                                           
                                                     
    when cmd = 'DELIMS' then                         
      do     
        say 'calling GETIMS with 'temp                     
        filerc = GETIMS(temp)                               
        rc = show_ims_results()                             
                                                           
        if filerc = 'EOF' then                             
          say 'GETIMS failed with EOF - segment not found' 
        else                                               
          do                                               
            temp1 = word(temp, 1)                           
            say 'calling DELIMS with 'temp1                 
            filerc = DELIMS(temp1)                         
            rc = show_ims_results()                         
                                                           
            say 'calling SAVEIMS'                           
            filerc = SAVEIMS()                             
            rc = show_ims_results()                         
          end                                               
      end                                                   
                                                           
    otherwise                                               
      say 'Unexpected FM IMS command 'cmd', line 'i         
  end                                                       
                                                           
end                                                         
                                                           
return 0                                                   
/******************************************************************** 
                                                                       
********************************************************************/ 
show_ims_results:                                                     
                                                                       
say 'filerc = 'filerc                                                 
say 'Inrec ***'inrec                                                   
say 'C2X Inrec ***'c2x(inrec)                                         
say 'FMCONKEY ***'FMCONKEY                                             
say 'FMSEGNM ***'FMSEGNM                                               
                                                                       
return 0                                                               
/**********************************************************************
                                                                       
**********************************************************************/
sub_novalue:                                                           
  say 'In sub_novalue in 'rname ; trace ?a                             
                                                                       
zedsmsg = ""                                                           
zedlmsg = rname" - Variable" ,                                         
          condition("Description") "undefined in line" sigl":"         
                                                                       
say zedlmsg                                                           
                                                                       
exit 8                                                                 
                                       

and finally, the actual FMI Rexx "instructions"
Quote:

--
-- 1ST SEGMENT SHOWN VIA FMI 3270 AND TABL
-- The strange characters after the CKEY= value is the packed representation of the root key
DELIMS SEGMENT=SFOFFID WHERE CKEY=mØ Ø}*


Be aware that you could receive errors like the system (RACF/ACF2) saying the IMSID is not available. In reality, it could well be that you don't have access authority to run/use RESOURCE NAME: FILEM.FUNCTION.IEB.xxxx where xxxx is the same value as that in the IMSID field.
Talk to your security people. (Mine found the problem via an SMF record).
Quote:

RFAC-FILEM.FUNCTION.IEB.xxxx *VIO RFAC-FILEM
ÖD5451000S6843F 1X6AUXX V5452485 SB44 ACF9CAUT NO-RULE - DIRECTRY READ
23.073 14/03 13.25 Sxxxxx Sxxxx SIMPSON MICHAEL 0 0 20 0 16
SAF RESOURCE CLASS FACILITY

RESOURCE NAME: FILEM.FUNCTION.IEB.xxxx

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group