Focal Point
[CLOSED] Running a cobol program from WebFocus

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7491097331

August 31, 2004, 09:46 PM
patino
[CLOSED] Running a cobol program from WebFocus
I just want to know if someone out there have experienced running cobol routines from web focus.
We have a webfocus reporting server on windows and we are using an eda adaptor to connect to our alpha machine. I can run a regular focus with no problem but I dont know how what to use/syntax for
calling a cobol routine. I tried most of the examples from the manual but nothing seems to work. Thanks.

This message has been edited. Last edited by: Kerry,
September 01, 2004, 04:36 PM
David Sibert
Be of good cheer.

I am running WebFocus 4.3.6 and 5.2.5 and MVS 7.1.1 and 7.2(a).

With this said. I need to know how your environment is set up.
At present I am running Webfocus that uses Cobol programs to Update/Insert into multiple DB2 databases and JCL to run other applications on the Mainframe.

So with a little bit more information I can point you in the correct direction.

Regards,
September 28, 2004, 08:17 PM
<Mike Miles>
Can you provide code examples of how you execute a COBOL program and submit JCL via WebFOCUS? Thanks.
September 29, 2004, 12:21 AM
<Pietro De Santis>
Modify the following example. This is assuming you have a JCL example on how to call a cobol program...

-SET &IRSTEMP = '&' | '&' | 'IRSTEMP' ;
-SET &COMMA = ',' ;
TSO ALLOC F(EXP01) DA(NEWJCL) NEW SPACE(10,10) TRACKS UNIT(PROD) BLKSIZE(80) -
DSORG(PS) LRECL(80) RECFM(F)
-RUN

-WRITE EXP01 //ZASIC04S JOB (ZASICG,O01A),' ', MSGCLASS=T
-WRITE EXP01 //STND OUTPUT PAGEDEF=V06481,DEST=RMT695,FORMDEF=010110
-WRITE EXP01 //HBCLIB JCLLIB ORDER=(YSMIC.FOCUS.PROCLIB)
-WRITE EXP01 //STEP1 EXEC FOCUS ,REGION=4096K
-WRITE EXP01 //MASTER DD DSN=ZIPIC.SRS.MASTER,DISP=SHR
-WRITE EXP01 //FOCEXEC DD DSN=ZIPIC.SRS.FOCEXEC,DISP=SHR
-WRITE EXP01 //IRSSDB1 DD DSN=ZHMIC.FCFSAM.SRS&SUBCLASS,DISP=SHR
-WRITE EXP01 //IRSTEMP DD DSN=ZIZIC.TEMP.INTERCEP,DISP=NEW
-WRITE EXP01 // DCB=(RECFM=FB,LRECL=240,BLKSIZE=23280)&COMMA
-WRITE EXP01 // UNIT=PROD,SPACE=(TRK,(10,1),RLSE)
-WRITE EXP01 //SYSIN DD *
-WRITE EXP01 TABLE FILE CAR
-WRITE EXP01 PRINT *
-WRITE EXP01 WHERE RECORDLIMIT EQ 10
-WRITE EXP01 END
-WRITE EXP01 FIN
-WRITE EXP01 //

TSO SUBMIT (NEWJCL)
TSO FREE F(EXP01)
TSO DELETE (NEWJCL)
-RUN
October 07, 2004, 01:25 PM
<MikeR>
I tried the following code in WebFOCUS:

-* File TESTSUB.FEX
-SET &IRSTEMP = '&' | '&' | 'IRSTEMP' ;
-SET &COMMA = ',' ;
TSO ALLOC F(EXP01) DA(NEWJCL) NEW SPACE(10,10) TRACKS UNIT(SYSDA) BLKSIZE(80) -
DSORG(PS) LRECL(80) RECFM(F)
-RUN

-WRITE EXP01 //MDRTEST JOB 3432000,RASMUSSN,MSGCLASS=X,CLASS=B
-WRITE EXP01 //STEP1 EXEC PGM=IEFBR14
-WRITE EXP01 //FILE1 DD DSN=ISMDR.TEMP,DISP=SHR
-WRITE EXP01 //*

TSO SUBMIT (NEWJCL)
TSO FREE F(EXP01)
TSO DELETE (NEWJCL)
-RUN

but when I run it, it doesn't like the TSO statements. What am I missing?
October 07, 2004, 05:40 PM
<Pietro De Santis>
This is all from so long ago. Are you in a TSO environment on the mainframe?

Try this, it's subtly different - it uses DYNAM ALLOC instead of TSO ALLOC. If I remember correctly, the -? TSO DDNAME command sets the environment variable &DSNAME so that the TSO SUBMIT can run correctly.

-SET &PROC = IF &&MM EQ '01' THEN 'SI920' ELSE 'SI921';

-SET &VIRGULE = ',';
-SET &NOMJOB = &&USERID || 'S';

-WRITE SI000T1 //&NOMJOB JOB (7272,E11),'H2Z1A4 16 JAMES DEAN',MSGCLASS=R
-WRITE SI000T1 /*RESSOURCE MEM=2000,CPU=2,LIG=10
-WRITE SI000T1 //*
-WRITE SI000T1 //PROC JCLLIB ORDER=(CT20.#7020.PROCLIB&VIRGULE
-WRITE SI000T1 // PI10.#1007.PROCLIB&VIRGULE
-WRITE SI000T1 // CT29.#8007.ES.PROCLIB)
-WRITE SI000T1 //*
-*RITE SI000T1 //&PROC EXEC &PROC
-WRITE SI000T1 //&PROC EXEC &PROC&VIRGULE
-WRITE SI000T1 // PREFLIB='PI10.#1007'&VIRGULE
-WRITE SI000T1 // PREFSI2='PI10.#1007'&VIRGULE
-WRITE SI000T1 // UNITDIS='DEVLOP'
-WRITE SI000T1 //SI920020.MASTER DD DSN=PI10.#1007.MASTER,DISP=SHR
-WRITE SI000T1 // DD DSN=CT20.#7020.MASTER,DISP=SHR
-WRITE SI000T1 //SI920030.STEPLIB DD DSN=CT20.#7020.CHGMT,DISP=SHR
-WRITE SI000T1 //SI920R1.STEPLIB DD DSN=CT20.#7020.CHGMT,DISP=SHR
-WRITE SI000T1 //SI920R1.DEST DD DSN=CT20.#7020.HQ.ADRESSE(H2Z1A432),DISP=SHR
-WRITE SI000T1 //SI920R1.RS0 DD SYSOUT=*,DCB=RECFM=A,OUTPUT=(*.OUT01)
-WRITE SI000T1 //YE050.STEPLIB DD DSN=CT20.#7020.LINKUSER,DISP=SHR

-? TSO DDNAME SI000T1

TSO SUBMIT '&DSNAME'
-RUN
October 11, 2004, 08:28 PM
<MikeR>
That could be the problem here. I am trying to get this to run from WEBFOCUS as opposed to FOCUS. Is that even possible?
October 11, 2004, 09:35 PM
David Sibert
You can do something similar to the two following conditions.

Control card

-WRITE JCL1 //&CARN JOB '2289,TEST,COM','BATCH REPORTS'&C
-WRITE JCL1 // CLASS=&JOBCLASS.,MSGCLASS=&MSGCLASS.,NOTIFY=&NOTIFY
-WRITE JCL1 //*------------------------------------------------
-WRITE JCL1 //SDEL EXEC PGM=IDCAMS
-WRITE JCL1 //SYSPRINT DD SYSOUT=*
-WRITE JCL1 //SYSIN DD *
-WRITE JCL1 DELETE &DSNAME
-WRITE JCL1 /*
-WRITE JCL1 //*

Execute part
-WRITE JCL1 //S50 EXEC TFOCUS
-WRITE JCL1 //FOCEXEC DD DSN=TEST.FOCUS.FOCEXEC,DISP=SHR
-WRITE JCL1 // DD DSN=PROD.FOCUS.FOCEXEC,DISP=SHR
-WRITE JCL1 //MASTER DD DSN=TEST.FOCUS.MASTER,DISP=SHR
-WRITE JCL1 // DD DSN=PROD.FOCUS.MASTER,DISP=SHR
-WRITE JCL1 //FOCSQL DD DSN=TEST.FOCUS.FOCSQL,DISP=SHR
-WRITE JCL1 // DD DSN=PROD.FOCUS.FOCSQL,DISP=SHR
-WRITE JCL1 //STEPLIB DD DSN=TEST.FOCUS.FOCLIB,DISP=SHR
-WRITE JCL1 // DD DSN=TEST.FOCUS.SQLLOAD,DISP=SHR
-WRITE JCL1 // DD DSN=DB2A.DSNLOAD,DISP=SHR
-WRITE JCL1 // DD DSN=PROD.IC.LOAD,DISP=SHR
-WRITE JCL1 // DD DSN=EDA.TEST.EDAUAT1.USERLIB,DISP=SHR
-WRITE JCL1 //USERLIB DD DSN=TEST.FOCUS.FUSELIB,DISP=SHR
-WRITE JCL1 // DD DSN=TEST.FOCUS.TNT.FUSELIB,DISP=SHR
-WRITE JCL1 // DD DSN=FOCUS.TNT.FUSELIB,DISP=SHR
-WRITE JCL1 // DD DSN=FOCUS.FUSELIB,DISP=SHR
-WRITE JCL1 // DD DSN=TEST.TRUST.LOAD,DISP=SHR
-WRITE JCL1 //FND470H DD DSN=FND.TEST.NAV.FND470HC,DISP=SHR
-WRITE JCL1 //SYSIN DD *
-WRITE JCL1 TSO SQL SET SSID XXXXX
-WRITE JCL1 TSO SQL SET PLAN DB2 plan name
-WRITE JCL1 TSO SQL SET ERRORTYPE DBMS
-WRITE JCL1 TSO SQL SET STATIC NOBIND
-WRITE JCL1 TSO SQL SET AUTODISCONNECT ON COMMIT
-WRITE JCL1 TSO SQL SET AUTOCLOSE ON COMMIT
-WRITE JCL1 TSO SQL SET OWNERID XXX
-WRITE JCL1 EX FOCEXEC(that executes the cobol program)
-WRITE JCL1 FIN
-WRITE JCL1 /*
-WRITE JCL1 //*
-CLOSE JCL1
-*
-TYPE SUBMIT TIME &FOCCPU
DYNAM SUBMIT JCL1
-RUN
DYNAM FREE FILE JCL1
-RUN

Running cobol from WEBFOCUS

SQL DB2 SET AUTOCOMMIT ON FIN
SQL DB2 SET PLAN DB2Named plan
-RUN
-********************************************************************
-*INVOKE COBOL PROGRAM
-********************************************************************

-SET &RETCODE=CALLDB2('DB2plan','cobol compile name','inparm1','inparm2','A12(out return code)');
-SET &RETPART1=SUBSTR(12,&RETCODE,1,8,8,'A8');
-SET &RETPART2=SUBSTR(12,&RETCODE,9,12,4,'A4');
-SET &RETNUM=BITVAL(&RETPART2,1,32,'I8');
-SET &LUW=IF &RETPART1 EQ 'COMPLETE' THEN 'SQL DB2 COMMIT WORK' ELSE
- 'SQL DB2 ROLLBACK WORK';
-RUN
&LUW
-IF &RETPART1 NE 'COMPLETE' GOTO BAD ELSE GOTO GOOD;
December 17, 2007, 09:29 AM
Gizmo
To issue a TSO command such as submit, you need to prefix TSO with a dash.

-TSO SUBMIT(jclfile)

The same goes for any other OS command
-DOS...
-UNIX...

but as David pointed out - using the DYNAM command should work just fine, and would work from a batch environment as well.

This message has been edited. Last edited by: Gizmo,



Windows: WF 7.6.2: SQL Server 2008 R2
May 02, 2011, 06:39 AM
Vinay Kumar
Hi All,

I know this is an old topic! I tried this code but i am getting an error.

Find the error in the below screenshot.


Could anyone help me.


WebFOCUS 7.6.4, Mainframe Focus
Windows XP, All Output Formats
May 02, 2011, 07:59 AM
FrankDutch
I suppose you are running on windows

TSO is not a windows/dos command




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

May 02, 2011, 08:04 AM
Vinay Kumar
Ya Frank, i am running on windows.

how to make the code run in windows?


WebFOCUS 7.6.4, Mainframe Focus
Windows XP, All Output Formats
May 02, 2011, 12:20 PM
<JG>
You cann't.

A windows WebFOCUS server cannot run a mainframe COBOL or any other type of mainframe procedure.

If you have remote server configured on the mainframe that the Windows WebFOCUS server can use
thne you may have possibilities using -REMOTE BEGIN/END

Otherwise no chance
May 02, 2011, 11:34 PM
Vinay Kumar
JG, i do have remote server configured, i will try REMOTE BEGIN/END and let you know my output.


WebFOCUS 7.6.4, Mainframe Focus
Windows XP, All Output Formats
May 04, 2011, 06:53 PM
Jim Morrow
If you use Micro-Focus COBOL (no relation to Information builders) to create a .exe. This can be called as a subroutine.

At least you could do this with FOCUS 6 for windows.

That was so long ago, I am not even going to look for an example. Because I am sure it is long gone.


Jim Morrow
Web Focus 7.6.10 under Windows 2003
MVS 7.3.3