Oo..
Em..How could i find the FTP comand in COBOL language?I mean, not using JCL to do the FTP..
I want to write a cobol program and include the FTP job inside the coding..
Anybody have any experience do this program?
Thank you.
Ok, i've got the URL..
But, i do not know whether this will work or not to call TSO FTP job or not..
Seem like will not work..
See the coding below.
Code:
//IBMUSERJ JOB (ACCT#),COB2TSO,
// NOTIFY=&SYSUID,
// CLASS=A,MSGCLASS=X,COND=(0,NE)
//COB2 EXEC PGM=IGYCRCTL
CBL NOLIB,APOST,NODECK,OBJECT,NOSEQ,BUF(10000),DYNAM
CBL NOMAP,NOLIST,NOOFFSET,NOXREF
Identification Division.
Program-ID. CB2TSOEV.
Author. Gilbert Saint-Flour.
******************************************************************
* *
* MODULE NAME = COB2TSO *
* *
* DESCRIPTIVE NAME = Issue TSO commands from a COBOL program. *
* *
* FUNCTION = This sample program demonstrates how to invoke *
* TSO commands from a COBOL program using *
* standard TSO services as documented in the *
* TSO/E Programming Services manual. *
* *
* Most TSO commands, including CLISTs and REXX *
* execs can be executed using this technique. *
* TSO commands which require authorization *
* (such as OUTPUT, SEND, TRANSMIT and RECEIVE) *
* will not work. *
* *
* Origin = http://gsf-soft.com/Download/ *
* *
******************************************************************
Data Division.
Working-Storage Section.
01 Filler.
05 ws-dummy Pic s9(8) Comp.
05 ws-return-code Pic s9(8) Comp.
05 ws-reason-code Pic s9(8) Comp.
05 ws-info-code Pic s9(8) Comp.
05 ws-cppl-address Pic s9(8) Comp.
05 ws-flags Pic X(4) Value X'00010001'.
05 ws-buffer Pic X(256).
05 ws-length Pic s9(8) Comp Value 256.
Procedure Division.
*----------------------------------------------------------------*
* Call IKJTSOEV to create the TSO/E environment *
*----------------------------------------------------------------*
CALL 'IKJTSOEV' Using ws-dummy
ws-return-code
ws-reason-code
ws-info-code
ws-cppl-address.
IF ws-return-code > zero
DISPLAY 'IKJTSOEV Failed, Return-code=' ws-return-code
' Reason-code=' ws-reason-code
'Info-code=' ws-info-code
MOVE ws-return-code to Return-code
STOP RUN.
*----------------------------------------------------------------*
* Build the TSO/E command in ws-buffer *
*----------------------------------------------------------------*
MOVE 'ALLOCATE DD(SYSPUNCH) SYSOUT HOLD' to ws-buffer.
*----------------------------------------------------------------*
* Call the TSO/E Service Routine to execute the TSO/E command *
*----------------------------------------------------------------*
CALL 'IKJEFTSR' Using ws-flags
ws-buffer
ws-length
ws-return-code
ws-reason-code
ws-dummy.
IF ws-return-code > zero
DISPLAY 'IKJEFTSR Failed, Return-code=' ws-return-code
' Reason-code=' ws-reason-code
MOVE ws-return-code to Return-code
STOP RUN.
*----------------------------------------------------------------*
* Check that the ALLOCATE command worked *
*----------------------------------------------------------------*
DISPLAY 'ALLOCATE Worked ! ' Upon Syspunch.
It stated that
" TSO commands which require authorization (such as OUTPUT, SEND, TRANSMIT and RECEIVE) will not work. "
FTP command require the authorization right?(Need username and password to perfome get/put command)
Oh ya?
superk, if you dont mine, can you post the example using the IKJTSOEV and IKJEFTSR calls to run an FTP? it is same like the code that i posted above?
Thank you..
PROCEDURE DIVISION.
CALL 'IKJTSOEV' USING WS-DUMMY WS-RETURN-CODE WS-REASON-CODE
WS-INFO-CODE WS-CPPL-ADDRESS.
IF WS-RETURN-CODE > ZERO
DISPLAY 'IKJTSOEV FAILED, RETURN-CODE=' WS-RETURN-CODE
' REASON-CODE=' WS-REASON-CODE 'INFO-CODE=' WS-INFO-CODE
MOVE WS-RETURN-CODE TO RETURN-CODE
STOP RUN.
OPEN OUTPUT FTP-INPUT.
MOVE SPACES TO INPUT-RECORD.
MOVE 'SERVER PORT' TO INPUT-RECORD.
WRITE INPUT-RECORD.
MOVE 'LS ' TO INPUT-RECORD.
WRITE INPUT-RECORD.
MOVE 'QUI ' TO INPUT-RECORD.
WRITE INPUT-RECORD.
CLOSE FTP-INPUT.
MOVE 'FTP' TO WS-BUFFER.
CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.
DISPLAY WS-BUFFER.
IF WS-RETURN-CODE > ZERO
DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
' REASON-CODE=' WS-REASON-CODE
MOVE WS-RETURN-CODE TO RETURN-CODE
STOP RUN.
I compiled the program and i got this error msg when try to link edit..
Why the symbol IKJTSOEV is unresolved?
Code:
1DFSMS/MVS V1 R4.0 BINDER 17:25:06 FRIDAY MARCH 10, 2006
BATCH EMULATOR JOB(PEPCOMP ) STEP(STEP1 ) PGM= HEWL PROCEDURE(LKED )
IEW2456E 9207 SYMBOL IKJTSOEV UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE DESIGNATED CALL LIBRARY.
IEW2638S 4321 AN EXECUTABLE VERSION OF MODULE COBFTP EXISTS AND CANNOT BE REPLACED BY THE NON-EXECUTABLE MODULE JUST
CREATED.
IEW2008I 0F03 PROCESSING COMPLETED. RETURN CODE = 12.
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
hy mrar_160,
you must include in your binder step (IEWL),
the library where the IKJTSOEV resides, ok.
the other question is: is it necessary, to call
IKJTSOEV statically? Try it dynamically and
the binder doesn't need to resolve that symbol.
you must include in your binder step (IEWL),
the library where the IKJTSOEV resides
Actually iam not very expert in cobol MVS..
i dont know to include binder step..
Quote:
Try it dynamically and
the binder doesn't need to resolve that symbol
Do you mean, i need to put any command not only to call IKJTSOEV then
the binder doesn't need to resolve that symbol?
Ok, i will try to put any command as well not only to call IKJTSOEV..
TQ.
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
hy,
this has nothing to do with cobol mvs directly.
you must bnd each obeject code before becoming
an executable. PGM=IEWL or HEWL..
look at yout compile job, there must be such a step,
normally after the compile step.
--> also: link edit , binder utility ...
in your syslib dd you must concatenate the dataset
containing IKJTSOEV...
to call a program dynamically means, you code
CALL PGM USING PAR1, PAR2 where PGM is X(08) including
the real program name as value. i.e IKJTSOEV
with this possibility, you concatanate the dataset containing
IKJTSOEV to the steplib dd.
the call will be resoved at run time.