Page 1 of 1

How to submit a job through online in natural ?

PostPosted: Mon May 03, 2010 4:39 pm
by diptisaini
Hi,

I just need to know how to submit a job through online screen in natural . Please find the details below :-

I am having a online screen containing 4 options e.g :-
1 ASSET MAPPING LIST
2 PRINT LBS-CORP-ACTION-DIARY
3 AWAIT REC/DEL BY BROK - F INT
4 AWAIT REC/DEL BY BROKER - FOP
so i have to include one more option e.g :-
1 ASSET MAPPING LIST
2 PRINT LBS-CORP-ACTION-DIARY
3 AWAIT REC/DEL BY BROK - F INT
4 AWAIT REC/DEL BY BROKER - FOP
5 Enquiry

then by entering that option a new map will open and that new map contain a field name as date E.g :-
Please input the Date of Selection:

Message Receive Date : 20100430 (YYYYMMDD)
By filling the date and pressing enter a job is submitted on backened and report is generated.
JOB SUCCESSFULLY SUBMITTED
Can anybody please help me on that ?

Re: How to submit a job through online in natural ?

PostPosted: Mon May 03, 2010 11:58 pm
by dick scherrer
Hello,

As this is already working, suggest you talk with the adabas/natural support/admin for direction on how this is to be done on your system.

Your process should be done the same way - which we are not familiar with.

Re: How to submit a job through online in natural ?

PostPosted: Tue May 04, 2010 9:33 am
by RGZbrog
You prepare the JCL statements in an array and pass them to NATRJE, which submits them to the internal reader.

You'll find code samples and an explanation of NATRJE in the documentation, under Utilities:

http://documentation.softwareag.com/natural/nat426mf2/utis/rje.htm#rje

Here's a sample program that demonstrates how to define the JCL in an array, substitute tokens (you'll need one for your date parameter), and submit the JCL. It also demonstrates how you can submit prepared JCL from a PDS.

DEFINE DATA LOCAL                                   
1 #JM (I4)              CONST <10>                   
1 #JCL (A80/#JM)         INIT                       
     <'//SPAWNJOB JOB (acct1,acct2,info),$USERID$,' 
     ,'//             MSGCLASS=Z,NOTIFY=&SYSUID,'   
     ,'//             USER=$USERID$,PASSWORD=$PSWD$'
     ,'//*'                                         
     ,'//TSO      EXEC PGM=IKJEFT01'                 
     ,'//SYSTSPRT  DD SYSOUT=*'                     
     ,'//SYSTSIN   DD *'                             
     ,'SUB "NAT.JCL($MEMBER$)"'                     
     ,'/*'                                           
     ,'//'                                           
     >                                               
1 #USERID (A8)          INIT <*USER>                 
1 #PSWD (A8)                                         
1 #PSW2 (A8)                                         
1 #MEMBER (A8)                                       
1 #RJE                                               
  2 #CNT (B4)                                       
  2 #END (A1)           INIT <'L'>                   
  2 #RRC (B4)                                       
1 #MSG (A70)                                         
*                                                   
1 #RC (I2)                                           
1 #I (I4)                                           
1 #B (I4)                                           
END-DEFINE                                           
*                                                   
DEFINE WINDOW MFSEC                                 
       SIZE 7*40                                     
       BASE 10/10                                   
       TITLE 'Mainframe Security'                   
       CONTROL SCREEN                               
       FRAMED ON                                     
SET KEY PF3                                         
*                                                   
REPEAT                                               
  INPUT WITH TEXT #MSG (CD=YE)                       
        'ENter JCL member name:' #MEMBER (AD=MDLT'_')         
  IF  *PF-KEY                = 'PF3'                         
   OR SUBSTR (#MEMBER, 1, 1) = '.'                           
    THEN                                                     
      STOP                                                   
  END-IF                                                     
  /*                                   Submit JCL             
  RESET INITIAL #JCL (*)                                     
  IF  #PSWD = ' '                                             
    THEN                                                     
      INPUT WINDOW='MFSEC'                                   
          / 'Enter Mainframe password:' #PSWD (AD=ANLT)       
         // '       Re-enter password:' #PSW2 (AD=ANLT)       
      IF  #PSWD = ' '                                         
        THEN                                                 
          REINPUT 'Password required for batch job submission'
                  MARK *#PSWD                                 
      END-IF                                                 
      IF  #PSWD <> #PSW2                                     
        THEN                                                 
          REINPUT 'Passwords do not match - please try again'
                  MARK *#PSWD                                 
      END-IF                                                 
      SET WINDOW OFF                                         
  END-IF                                                     
  EXAMINE #JCL (*) FOR '$USERID$' REPLACE #USERID             
  EXAMINE #JCL (*) FOR '$PSWD$'   REPLACE #PSWD               
  EXAMINE #JCL (*) FOR '$MEMBER$' REPLACE #MEMBER             
  ASSIGN #RJE.#CNT = #JM                                     
  ASSIGN #RJE.#END = 'L'                                     
  CALL 'NATRJE' #JCL (*)                                     
                #RJE.#CNT                                     
                #RJE.#END                                     
                #RJE.#RRC                                     
  IF  #RJE.#RRC = 0                                           
    THEN                                                     
      ASSIGN #MSG = 'Job submitted'                           
    ELSE                                                     
      ASSIGN #MSG = 'Job submission failed'                   
  END-IF 
END-REPEAT
END