products/sources/formale Sprachen/JCL/jcl3/cblpar01.htm |
 |
<!DOCTYPE HTML PUBLIC "-//SimoTime//DTD HTML 4.0 Transitional//EN" "hmpro6.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="Author" CONTENT="Larry Simmons">
<META NAME="Generator" CONTENT="SimoTime Version 2002.07.01">
<META NAME="KEYWORDS"
CONTENT="Mainframe,OS390,OS/390,390,COBOL,MVS,JCL,PARM,PARM=,exec,statement,keyword,parameter,string,literal,sample,samples,example,examples,pass,passing,sysin.accept">
<META NAME="description"
CONTENT="How do you pass a parameter string from JCL to COBOL? This suite of programs provides a sample COBOL program processing a parameter string from mainframe JCL via the PARM keyword or SYSIN. This programming example and documentation are packa
ged as a zip file for easy downloading.">
<TITLE> Passing JCL Parameters to a COBOL Program</TITLE> <STYLE TYPE="TEXT/CSS">
P {FONT-FAMILY: Arial,Helvetica; FONT-SIZE: 12px}
H1 {FONT-FAMILY: TIMES NEW ROMAN; FONT-SIZE: 28px; color: navy}
H2 {FONT-FAMILY: TIMES NEW ROMAN; FONT-SIZE: 18px; color: navy}
H3 {FONT-FAMILY: TIMES NEW ROMAN; FONT-SIZE: 16px; color: navy}
H4 {FONT-FAMILY: TIMES NEW ROMAN; FONT-SIZE: 14px; color: navy}
TD {FONT-FAMILY: Arial,Helvetica; FONT-SIZE: 12px}
</STYLE>
</HEAD>
<BODY>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="20%" ALIGN="LEFT">
<A NAME="TOC" STYLE="font-size: 6pt"><IMG SRC="simotime.gif"
WIDTH="165" HEIGHT="55" BORDER="0"> </A></TD>
<TD WIDTH="80%" ALIGN="LEFT">
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0"
ALIGN="RIGHT" BORDER="0">
<TR>
<TD ALIGN="RIGHT" NOWRAP="NOWRAP"><FONT
STYLE="font-size: 24pt; font-weight: bold; color: navy"> COBOL with JCL
Parameter</FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD><FONT
STYLE="font-style: italic; font-size: 12pt; font-family: Arial; color: maroon; font-weight: bold; font-variant: normal">When
technology complements business </FONT></TD>
<TD ALIGN="RIGHT"><FONT
STYLE="font-size: 14pt; font-weight: normal; color: maroon; font-style: italic">Process
JCL Parameter</FONT></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD STYLE="color: gray; font-size: 8pt"><FONT
STYLE="font-size: 12px; font-weight: normal; color: gray">Copyright ©
1987-2005 SimoTime Enterprises, LLC All Rights Reserved</FONT></TD>
<TD ALIGN="RIGHT" NOWRAP="NOWRAP">
<A HREF="http://www.simotime.com"
STYLE="font-size: 12px; font-weight: normal; color: blue"
ONMOUSEOVER="this.style.color='FF0000'"
ONMOUSEOUT="this.style.color='0000FF'">http://www.simotime.com </A></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE> <HR SIZE="4" COLOR="navy">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="2" CELLPADDING="0"
BGCOLOR="#FFFFC0">
<TR>
<TD WIDTH="5px"> </TD>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD>
<A HREF="#Introduction" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 14px; font-weight: bold; text-decoration: none">Introduction</A></TD>
<TD ALIGN="RIGHT"><FONT
STYLE="color: blue; font-size: 12px; text-decoration: none; font-style: italic">Version
03.12.02</FONT></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD> </TD>
<TD><A HREF="#ParameterPassingParm"
ONMOUSEOUT="this.style.color='0000FF'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 14px; font-weight: bold; text-decoration: none">Passing
a Parameter via PARM=</A></TD>
</TR>
<TR>
<TD> </TD>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#JclMemberParm" ONMOUSEOVER="this.style.color='FF0000'"
ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The JCL Member
using PARM=</A></TD>
</TR>
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD><A HREF="#CobolProgramParm"
ONMOUSEOVER="this.style.color='FF0000'" ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The COBOL Program
using PARM=</A></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD> </TD>
<TD>
<A HREF="#ParameterPassingSysin" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 14px; font-weight: bold; text-decoration: none">Passing
a Parameter via SYSIN</A> </TD>
</TR>
<TR>
<TD> </TD>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#JclMemberSysin" ONMOUSEOVER="this.style.color='FF0000'"
ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The JCL Member
using SYSIN</A></TD>
</TR>
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD><A HREF="#CobolProgramSysin"
ONMOUSEOVER="this.style.color='FF0000'" ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The COBOL Program
using SYSIN</A></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD> </TD>
<TD><A HREF="#ParameterPassingSysinMultiple"
ONMOUSEOUT="this.style.color='0000FF'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 14px; font-weight: bold; text-decoration: none">Passing
Multiple Parameters via SYSIN</A></TD>
</TR>
<TR>
<TD> </TD>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#JclMemberSysinMultiple" ONMOUSEOVER="this.style.color='FF0000'"
ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The JCL Member
using SYSIN with Multiple Parameters</A></TD>
</TR>
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD><A HREF="#CobolProgramSysinMultiple"
ONMOUSEOVER="this.style.color='FF0000'" ONMOUSEOUT="this.style.color='0000FF'"
STYLE="color: blue; font-size: 12px; text-decoration: none">The COBOL Program
using SYSIN with Multiple Parameters</A></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD> </TD>
<TD><A HREF="#Summary" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 14px; text-decoration: none; font-weight: bold">Summary</A></TD>
</TR>
<TR>
<TD> </TD>
<TD>
<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#SoftwareAgreementDisclaimer" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 12px; text-decoration: none">Software Agreement
and Disclaimer</A></TD>
</TR>
<TR>
<TD WIDTH="3%" STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#SimilarPoints" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 12px; text-decoration: none">Downloads and Links
to Similar Pages</A></TD>
</TR>
<TR>
<TD STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#Comments" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 12px; text-decoration: none">Comments or
Suggestions</A></TD>
</TR>
<TR>
<TD STYLE="font-size: 10pt"> </TD>
<TD>
<A HREF="#AboutSimoTime" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: blue; font-size: 12px; text-decoration: none">About
SimoTime</A></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE> <HR SIZE="4" COLOR="navy">
<H1> <A NAME="Introduction">Introduction </A><FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR> (<A
HREF="#ParameterPassingParm"
ONMOUSEOUT="this.style.color='808080'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Next</A>) (<A HREF="#TOC"
ONMOUSEOUT="this.style.color='808080'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Previous</A>) (<A HREF="#TOC"
ONMOUSEOUT="this.style.color='808080'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H1>
<P>This suite of programs provides an example of how to pass a parameter
string from mainframe JCL to a COBOL program. The COBOL program is written
using COBOL/2 dialect but also works with COBOL for MVS and COBOL/370. A JCL
member is provided to run the job as an MVS batch job on an IBM mainframe or as
a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows
(refer to
<A HREF="http://www.microfocus.com" ONMOUSEOUT="this.style.color='0000FF'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: blue"
TARGET="_blank">http://www.microfocus.com </A>). This program may serve as a
tutorial for programmers that are new to COBOL and mainframe JCL and as a
reference for experienced programmers.</P>
<P>The two techniques use to pass information <I>(a Parameter)</I> from JCL
to a program are as follows.</P>
<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0">
<TR>
<TD NOWRAP="NOWRAP"><B>Technique</B> </TD>
<TD><B>Description</B></TD>
</TR>
<TR>
<TD VALIGN="TOP"><B>via PARM=</B></TD>
<TD>This technique uses a PARM=<I>parameter</I> keyword on the EXEC
statement in JCL. The COBOL program requires a LINKAGE SECTION.</TD>
</TR>
<TR>
<TD VALIGN="TOP"><B>via SYSIN</B></TD>
<TD>This technique requires SYSIN statement followed by the parameter
to be placed in the JCL. The COBOL program requires an "ACCEPT parameter
from SYSIN" to be coded in the COBOL program. If the SYSIN statement is missing
in the JCL the ACCEPT will ABEND with a "File not found" message. To avoid this
it will be necessary to use a "//SYSIN DD DUMMY" statment in the JCL when a
parameter is not being passed.</TD>
</TR>
</TABLE>
<P>The following sections describe parameter-passing in more detail. </P>
<H1> <A NAME="ParameterPassingParm">Passing a Parameter via PARM=</A><BR>
<FONT FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal">(<A
HREF="#JclMemberParm" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#Introduction" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H1>
<P>To pass a parameter from JCL to a program requires the use of the
"PARM=" keyword with the EXEC statement. The following JCL statement shows an
EXEC statement without a parameter defined.</P>
<H2> <A NAME="JclMemberParm">The JCL Member using PARM=</A><FONT
FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#CobolProgramParm" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#ParameterPassingParm"
ONMOUSEOUT="this.style.color='808080'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Previous</A>) (<A HREF="#TOC"
ONMOUSEOUT="this.style.color='808080'" ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>The following is the mainframe JCL <FONT
STYLE="color: maroon">(CBLPARJ1.JCL)</FONT> required to run as a job on the
mainline. This will also run on the PC using Mainframe Express provided by
Micro Focus. The job contains two steps. The first step will execute the COBOL
program (CBLPARC1.CBL) without passing a parameter. The second step will
execute the COBOL program and pass a parameter. The JOB statement will need to
be modified for specific mainframe environments.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//CBLPARJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//* *******************************************************************
//* This program is provided by: *
//* SimoTime Enterprises, LLC *
//* (C) Copyright 1987-2003 All Rights Reserved *
//* *
//* Web Site URL: http://www.simotime.com *
//* e-mail: [email protected] *
//* *******************************************************************
//*
//* Text - Process a parameter string passed from the JCL
//* Author - SimoTime Enterprises
//* Date - January 24, 1996
//*
//* This is a sample program that shows how a COBOL program can
//* process input from the JCL using the PARM keyword from the EXEC
//* statement.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express
//*
//* *******************************************************************
//* Step 1 of 3, Execute the COBOL program without a parameter.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ1S01 EXEC PGM=CBLPARC1
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
//* *******************************************************************
//* Step 2 of 3, Execute the COBOL program with a parameter.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ1S02 EXEC PGM=CBLPARC1,
// PARM='This is a Parameter from the EXEC and PARM= ...'
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
//* *******************************************************************
//* Step 3 of 3, Execute the COBOL program with a parameter.
//* The PARM= has a record length maximum of 100.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ1S03 EXEC PGM=CBLPARC1,
// PARM='....:....1....:....2....:....3....:....4....:....5X
// ....:....6....:....7....:....9....:...10....:...11'
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
</FONT></PRE>
<H2> <A
NAME="CobolProgramParm">The COBOL Program using PARM=</A><FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#ParameterPassingSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#JclMemberParm" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>This program <FONT STYLE="color: maroon">(CBLPARC1.CBL)</FONT> was
written to be used as a teaching and learning aid. When a COBOL program is
executed from a JCL member a data string (or parameter) may be passed from the
JCL member to the COBOL program using the PARM keyword as follows.</P>
<PRE><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//CBLPARS2 EXEC PGM=CBLPARC1,<B>PARM='datastring'</FONT></PRE>
<P>When the data string is passed from JCL to COBOL it is preceded with a
two-byte binary value that specifies the length of the data string. For
example, if the data string is ten characters in length the actual information
passed to the COBOL program would be a two-byte binary value of ten or x'000A'
followed by the ten character data string. If the COBOL program is executed
from JCL without a parameter the two-byte binary value would be zero or
x'0000'.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> IDENTIFICATION DIVISION.</B>
PROGRAM-ID. CBLPARC1.
AUTHOR. SIMOTIME ENTERPRISES.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Copyright (C) 1987-2003 SimoTime Enterprises, LLC. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* Permission to use, copy, modify and distribute this software *
* for any non-commercial purpose and without fee is hereby *
* granted, provided the SimoTime copyright notice appear on all *
* copies of the software. The SimoTime name or Logo may not be *
* used in any advertising or publicity pertaining to the use *
* of the software without the written permission of SimoTime *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. Once the fee is received by SimoTime *
* the latest version of the software will be delivered and a *
* license will be granted for use within an enterprise, *
* provided the SimoTime copyright notice appear on all copies *
* of the software. The SimoTime name or Logo may not be used *
* in any advertising or publicity pertaining to the use of the *
* software without the written permission of SimoTime *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises shall not be liable for any direct, indirect, *
* special or consequential damages resulting from the loss of *
* use, data or projects, whether in an action of contract or *
* tort, arising out of or in connection with the use or *
* performance of this software *
* *
* SimoTime Enterprises *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
*
*****************************************************************
* Source Member: CBLPARC1.CBL
*****************************************************************
*
* CBLPARC1 - This program will process a JCL parameter.
*
* CALLING PROTOCOL
* ----------------
* USE STANDARD PROCEDURE TO EXECUTE, RUN OR ANIMATE.
*
* DESCRIPTION
* -----------
* This program will process the JCL parameter from the PARM
* keyword of the EXEC staement.
*
* // EXEC PGM=PROGNAME,PARM='text string...'
*
* This program will simply display the text string.
*
****************************************************************
*
* MAINTENANCE
* -----------
* 1997/02/27 Simmons, Created program.
*
*****************************************************************
*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> DATA DIVISION.</B>
<B> WORKING-STORAGE SECTION.</B>
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *
*****************************************************************
* Data-structure for Title and Copyright...
* ------------------------------------------------------------
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'> 01 SIM-TITLE.
05 T1 pic X(11) value '* CBLPARC1 '.
05 T2 pic X(34) value 'Sample, Process a JCL Parameter '.
05 T3 pic X(10) value ' v03.01.24'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLPARC1 '.
05 C2 pic X(20) value 'Copyright 1987-2003 '.
05 C3 pic X(28) value ' SimoTime Enterprises, LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBLPARC1 '.
05 C2 pic X(32) value 'Thank you for using this sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises, LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLPARC1 '.
05 C2 pic X(32) value 'Please send comments or suggesti'.
05 C3 pic X(32) value 'ons to [email protected] '.
05 C4 pic X(04) value ' '.
01 FIRST-TIME pic X value 'Y'.
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLPARC1 '.
05 MESSAGE-TEXT pic X(128).
01 MESSAGE-TEXT-01.
05 filler pic X(20) value 'Parameter length is '.
05 JCL-PARM-LENGTH pic 9(5) value 0.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> LINKAGE SECTION.</B>
01 PARM-BUFFER.
05 PARM-LENGTH pic S9(4) comp.
05 PARM-DATA pic X(256).
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> PROCEDURE DIVISION using PARM-BUFFER.</B>
if FIRST-TIME not = 'N'
perform Z-POST-COPYRIGHT
move 'N' to FIRST-TIME
end-if
add PARM-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE
if PARM-LENGTH > 0
move PARM-DATA(1:PARM-LENGTH) to MESSAGE-TEXT
perform Z-POST-MESSAGE
end-if
perform Z-THANK-YOU.
GOBACK.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Display Copyright or Program Messages...
*****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-COPYRIGHT.</B>
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-MESSAGE.</B>
display MESSAGE-BUFFER upon console
move SPACES to MESSAGE-TEXT
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-THANK-YOU.</B>
display SIM-THANKS-01 upon console
display SIM-THANKS-02 upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************</FONT></PRE>
<H1> <A NAME="ParameterPassingSysin">Passing a Parameter via SYSIN</A><BR>
<FONT FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal">(<A
HREF="#JclMemberSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#CobolProgramParm" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H1>
<P>To pass a parameter from SYSIN to a program requires the use of DD
statement for SYSIN. The following JCL statement is required if no parameter is
passed.</P>
<PRE><FONT STYLE="font-size: 14px; color: maroon">//* *******************************************************************
//* Step 1 of 2, Execute the COBOL program without a parameter.
//*</FONT>
<FONT STYLE="font-size: 14px; color: navy">//SYSIN DD DUMMY
</FONT></PRE>
<H2> <A NAME="JclMemberSysin">The JCL Member using SYSIN</A><FONT
FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#CobolProgramSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#ParameterPassingSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>The following is the mainframe JCL <FONT
STYLE="color: maroon">(CBLPARJ2.JCL)</FONT> required to run as a job on the
mainline. This will also run on the PC using Mainframe Express provided by
Micro Focus. The job contains two steps. The first step will execute the COBOL
program (CBLPARC2.CBL) without passing a parameter. The second step will
execute the COBOL program and pass a parameter. The JOB statement will need to
be modified for specific mainframe environments.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//CBLPARJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//* *******************************************************************
//* This program is provided by: *
//* SimoTime Enterprises, LLC *
//* (C) Copyright 1987-2003 All Rights Reserved *
//* *
//* Web Site URL: http://www.simotime.com *
//* e-mail: [email protected] *
//* *******************************************************************
//*
//* Text - Process a parameter string passed from the JCL
//* Author - SimoTime Enterprises
//* Date - January 24, 1996
//*
//* This is a sample program that shows how a COBOL program can
//* process input from the JCL using SYSIN.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express
//*
//* *******************************************************************
//* Step 1 of 2, Execute the COBOL program without a parameter.
//*
//* The //SYSIN DD DUMMY is required to prevent the COBOL
//* program from ABENDING on the ACCEPT ... from SYSIN.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ2S01 EXEC PGM=CBLPARC2
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSIN DD DUMMY
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
//* *******************************************************************
//* Step 2 of 2, Execute the COBOL program with a parameter.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ2S02 EXEC PGM=CBLPARC2
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSIN DD *
This is a single parameter from PARJ2S02 and SYSIN-DD-* ...
/*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//
</FONT></PRE>
<H2> <A NAME="CobolProgramSysin">The COBOL Program using SYSIN</A><FONT
FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#ParameterPassingSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#JclMemberSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>The following is the COBOL program <FONT
STYLE="color: maroon">(CBLPARC2.CBL)</FONT> required to run as a job on the
mainline. This will also run on the PC using Mainframe Express provided by
Micro Focus. The job contains two steps. The first step will execute the COBOL
program (CBLPARC2.CBL) without passing a parameter. The second step will
execute the COBOL program and pass a parameter via SYSIN. The JOB statement
will need to be modified for specific mainframe environments.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> IDENTIFICATION DIVISION.</B>
PROGRAM-ID. CBLPARC2.
AUTHOR. SIMOTIME ENTERPRISES.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Copyright (C) 1987-2003 SimoTime Enterprises, LLC. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* Permission to use, copy, modify and distribute this software *
* for any non-commercial purpose and without fee is hereby *
* granted, provided the SimoTime copyright notice appear on all *
* copies of the software. The SimoTime name or Logo may not be *
* used in any advertising or publicity pertaining to the use *
* of the software without the written permission of SimoTime *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. Once the fee is received by SimoTime *
* the latest version of the software will be delivered and a *
* license will be granted for use within an enterprise, *
* provided the SimoTime copyright notice appear on all copies *
* of the software. The SimoTime name or Logo may not be used *
* in any advertising or publicity pertaining to the use of the *
* software without the written permission of SimoTime *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises shall not be liable for any direct, indirect, *
* special or consequential damages resulting from the loss of *
* use, data or projects, whether in an action of contract or *
* tort, arising out of or in connection with the use or *
* performance of this software *
* *
* SimoTime Enterprises *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
*
*****************************************************************
* Source Member: CBLPARC2.CBL
*****************************************************************
*
* CBLPARC2 - This program will process a SYSIN parameter.
*
* CALLING PROTOCOL
* ----------------
* USE STANDARD PROCEDURE TO EXECUTE, RUN OR ANIMATE.
*
* DESCRIPTION
* -----------
* This program will process the JCL parameter from SYSIN.
*
* //SYSIN DD *
* Parameter from SYSIN...
* //*
*
* or a DUMMY is required to avoid an ABEND on the ACCEPT...
*
* //SYSIN DD DUMMY
*
* This program will simply display the text string.
*
****************************************************************
*
* MAINTENANCE
* -----------
* 1997/02/27 Simmons, Created program.
*
*****************************************************************
*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> DATA DIVISION.</B>
<B> WORKING-STORAGE SECTION.</B>
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *
*****************************************************************
* Data-structure for Title and Copyright...
* ------------------------------------------------------------
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'> 01 SIM-TITLE.
05 T1 pic X(11) value '* CBLPARC2 '.
05 T2 pic X(34) value 'Sample, Process SYSIN Parameter '.
05 T3 pic X(10) value ' v03.01.24'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLPARC2 '.
05 C2 pic X(20) value 'Copyright 1987-2003 '.
05 C3 pic X(28) value ' SimoTime Enterprises, LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBLPARC2 '.
05 C2 pic X(32) value 'Thank you for using this sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises, LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLPARC2 '.
05 C2 pic X(32) value 'Please send comments or suggesti'.
05 C3 pic X(32) value 'ons to [email protected] '.
05 C4 pic X(04) value ' '.
01 FIRST-TIME pic X value 'Y'.
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLPARC2 '.
05 MESSAGE-TEXT pic X(128).
01 MESSAGE-TEXT-01.
05 filler pic X(20) value 'Parameter length is '.
05 JCL-PARM-LENGTH pic 9(5) value 0.
01 SYSIN-PARAMETER pic X(80) value SPACES.
01 SYSIN-LENGTH pic 9(5) value 0.
01 IX-1 pic 9(3) value 0.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> PROCEDURE DIVISION.</B>
if FIRST-TIME not = 'N'
perform Z-POST-COPYRIGHT
move 'N' to FIRST-TIME
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *> A DD statement is required or a hard ABEND will occur
*> on the ACCEPT. If no parameters are passed then a
*> //SYSIN DD DUMMY is required to prevent the COBOL
*> program from ABENDING on the ACCEPT ... from SYSIN.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'> accept SYSIN-PARAMETER from SYSIN
end-if
subtract SYSIN-LENGTH from SYSIN-LENGTH
if SYSIN-PARAMETER = SPACES
add SYSIN-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE
else
perform CALCULATE-TEXT-LENGTH
add SYSIN-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE
move SYSIN-PARAMETER to MESSAGE-TEXT
perform Z-POST-MESSAGE
end-if
perform Z-THANK-YOU.
GOBACK.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> CALCULATE-TEXT-LENGTH.</B>
add 1 to ZERO giving IX-1
perform 80 times
if SYSIN-PARAMETER(IX-1:1) not = SPACE
add IX-1 to ZERO giving SYSIN-LENGTH
end-if
add 1 to IX-1
end-perform
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Display Copyright or Program Messages...
*****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-COPYRIGHT.</B>
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-MESSAGE.</B>
display MESSAGE-BUFFER upon console
move SPACES to MESSAGE-TEXT
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-THANK-YOU.</B>
display SIM-THANKS-01 upon console
display SIM-THANKS-02 upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************</FONT></PRE>
<H1> <A NAME="ParameterPassingSysinMultiple">Passing Multiple Parameters
via SYSIN</A><BR>
<FONT FACE="Arial" STYLE="color: gray; font-size: 8pt; font-weight: normal">(<A
HREF="#JclMemberSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#CobolProgramSysin" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H1>
<P>To pass multiple parameters (or records) from SYSIN to a program
requires the use of DD statement for SYSIN. The following JCL statement is
required if no parameter is passed.</P>
<PRE><FONT STYLE="font-size: 14px; color: maroon">//* *******************************************************************
//* Step 1 of 2, Execute the COBOL program without a parameter.
//*</FONT>
<FONT STYLE="font-size: 14px; color: navy">//SYSIN DD DUMMY
</FONT></PRE>
<H2> <A NAME="JclMemberSysinMultiple">The JCL Member using SYSIN with
Multiple Parameters</A><FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#CobolProgramSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#ParameterPassingSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>The following is the mainframe JCL <FONT
STYLE="color: maroon">(CBLPARJ3.JCL)</FONT> required to run as a job on the
mainline. This will also run on the PC using Mainframe Express provided by
Micro Focus. The job contains two steps. The first step will execute the COBOL
program (CBLPARC3CBL) without passing a parameter. The second step will execute
the COBOL program and pass provide three parameters. The JOB statement will
need to be modified for specific mainframe environments.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//CBLPARJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//* *******************************************************************
//* This program is provided by: *
//* SimoTime Enterprises, LLC *
//* (C) Copyright 1987-2003 All Rights Reserved *
//* *
//* Web Site URL: http://www.simotime.com *
//* e-mail: [email protected] *
//* *******************************************************************
//*
//* Text - Process a parameter string passed from the JCL
//* Author - SimoTime Enterprises
//* Date - January 24, 1996
//*
//* This is a sample program that shows how a COBOL program can
//* process input from the JCL using SYSIN.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express
//*
//* *******************************************************************
//* Step 1 of 3, Execute the COBOL program without a parameter.
//*
//* The //SYSIN DD DUMMY is required to prevent the COBOL
//* program from ABENDING on the ACCEPT ... from SYSIN.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ3S01 EXEC PGM=CBLPARC3
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSIN DD DUMMY
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
//* *******************************************************************
//* Step 2 of 3, Execute the COBOL program with multiple parameters.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ3S02 EXEC PGM=CBLPARC3
//STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//SYSIN DD *
This is Parameter 01 from PARJ3S02 and SYSIN-DD-*.
This is Parameter 02 from PARJ3S02 and SYSIN-DD-*..
This is Parameter 03 from PARJ3S02 and SYSIN-DD-*...
/*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
//* *******************************************************************
//* Step 3 of 3, Execute the COBOL program with control file.
//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//PARJ3S03 EXEC PGM=CBLPARC3
//STEPLIB DD DISP=SHR,DSN=SIMOTIME.DEMO.LOADLIB1
//SYSIN DD DISP=SHR,DSN=SIMOTIME.DEMO.CNTLDECK(CBLPARS3)
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'>//*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>//
</FONT></PRE>
<P>In the preceding JCL example Step 3 of 3 passes parameters from a SYSIN
Data Set (SIMOTIME.DEMO.CNTLDECK(CBLPARS3)) to the COBOL program. The SYSIN
data set includes the following records.</P>
<PRE><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'>Parameter 01 from control file specified by SYSIN-DD-CBLPARS3.
Parameter 02 from control file specified by SYSIN-DD-CBLPARS3..
Parameter 03 from control file specified by SYSIN-DD-CBLPARS3...
</FONT></PRE>
<H2> <A NAME="CobolProgramSysinMultiple">The COBOL Program using SYSIN with
Multiple Parameters</A><FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#Summary" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#JclMemberSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>The following is the COBOL program <FONT
STYLE="color: maroon">(CBLPARC3.CBL)</FONT> required to run as a job on the
mainline. This will also run on the PC using Mainframe Express provided by
Micro Focus. The job contains two steps. The first step will execute the COBOL
program (CBLPARC3.CBL) without passing a parameter. The second step will
execute the COBOL program and pass a parameter via SYSIN. The JOB statement
will need to be modified for specific mainframe environments.</P>
<PRE>
<FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> IDENTIFICATION DIVISION.</B>
PROGRAM-ID. CBLPARC3.
AUTHOR. SIMOTIME ENTERPRISES.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Copyright (C) 1987-2003 SimoTime Enterprises, LLC. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* Permission to use, copy, modify and distribute this software *
* for any non-commercial purpose and without fee is hereby *
* granted, provided the SimoTime copyright notice appear on all *
* copies of the software. The SimoTime name or Logo may not be *
* used in any advertising or publicity pertaining to the use *
* of the software without the written permission of SimoTime *
* Enterprises.This software contains confidential information *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* Simotime Enterprises. Once the fee is received by SimoTime *
* the latest version of the software will be delivered and a *
* license will be granted for use within an enterprise, *
* provided the SimoTime copyright notice appear on all copies *
* of the software. The SimoTime name or Logo may not be used *
* in any advertising or publicity pertaining to the use of the *
* software without the written permission of SimoTime *
* Enterprises. *
* *
* SimoTime Enterprises makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any express or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Enterprises shall not be liable for any direct, indirect, *
* special or consequential damages resulting from the loss of *
* use, data or projects, whether in an action of contract or *
* tort, arising out of or in connection with the use or *
* performance of this software *
* *
* SimoTime Enterprises *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
*
*****************************************************************
* Source Member: CBLPARC3.CBL
*****************************************************************
*
* CBLPARC3 - This program will process a SYSIN parameter.
*
* CALLING PROTOCOL
* ----------------
* USE STANDARD PROCEDURE TO EXECUTE, RUN OR ANIMATE.
*
* DESCRIPTION
* -----------
* This program will process the JCL parameter from SYSIN.
*
* //SYSIN DD *
* Parameter from SYSIN...
* //*
*
* or a DUMMY is required to avoid an ABEND on the ACCEPT...
*
* //SYSIN DD DUMMY
*
* This program will simply display the text string.
*
****************************************************************
*
* MAINTENANCE
* -----------
* 1997/02/27 Simmons, Created program.
*
*****************************************************************
*
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> DATA DIVISION.</B>
<B> WORKING-STORAGE SECTION.</B>
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *
*****************************************************************
* Data-structure for Title and Copyright...
* ------------------------------------------------------------
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'> 01 SIM-TITLE.
05 T1 pic X(11) value '* CBLPARC3 '.
05 T2 pic X(34) value 'Sample, Process SYSIN Parameter '.
05 T3 pic X(10) value ' v03.04.22'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLPARC3 '.
05 C2 pic X(20) value 'Copyright 1987-2003 '.
05 C3 pic X(28) value ' SimoTime Enterprises, LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBLPARC3 '.
05 C2 pic X(32) value 'Thank you for using this sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises, LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLPARC3 '.
05 C2 pic X(32) value 'Please send comments or suggesti'.
05 C3 pic X(32) value 'ons to [email protected] '.
05 C4 pic X(04) value ' '.
01 FIRST-TIME pic X value 'Y'.
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLPARC3 '.
05 MESSAGE-TEXT pic X(128).
01 MESSAGE-TEXT-01.
05 filler pic X(20) value 'Parameter length is '.
05 JCL-PARM-LENGTH pic 9(5) value 0.
01 SYSIN-PARAMETER pic X(80) value SPACES.
01 SYSIN-LENGTH pic 9(5) value 0.
01 IX-1 pic 9(3) value 0.
<B> COPY PASSDUMP.</B>
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> PROCEDURE DIVISION.</B>
if FIRST-TIME not = 'N'
perform Z-POST-COPYRIGHT
move 'N' to FIRST-TIME
end-if
perform 4 times
move SPACES to SYSIN-PARAMETER
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *> A DD statement is required or a hard ABEND will occur
*> on the ACCEPT. If no parameters are passed then a
*> //SYSIN DD DUMMY is required to prevent the COBOL
*> program from ABENDING on the ACCEPT ... from SYSIN.
*> Since there is no File Status code for the accept then
*> an ACCEPT after the final record is read from SYSIN
*> will leave the buffer in the state before the request.
*> In this example the buffer is always initialized with
*> space characters and the logic in the program will
*> determine a ZERO record length and the routine should
*> stop accepting (or reading) from SYSIN. The following
*> example intentionally reads (or accepts) beyond the
*> SYSIN records available to show a technique for
*> handling this possibility.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'> accept SYSIN-PARAMETER from SYSIN
subtract SYSIN-LENGTH from SYSIN-LENGTH
if SYSIN-PARAMETER = SPACES
add SYSIN-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE
else
perform CALCULATE-TEXT-LENGTH
add SYSIN-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE
move SYSIN-PARAMETER to MESSAGE-TEXT
perform Z-POST-MESSAGE
end-if
end-perform
perform Z-THANK-YOU.
GOBACK.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> CALCULATE-TEXT-LENGTH.</B>
add 1 to ZERO giving IX-1
inspect SYSIN-PARAMETER replacing all LOW-VALUES by SPACES
perform 80 times
if SYSIN-PARAMETER(IX-1:1) not = SPACE
add IX-1 to ZERO giving SYSIN-LENGTH
end-if
add 1 to IX-1
end-perform
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* Display Copyright or Program Messages...
*****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-COPYRIGHT.</B>
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-POST-MESSAGE.</B>
display MESSAGE-BUFFER upon console
move SPACES to MESSAGE-TEXT
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: navy'><B> Z-THANK-YOU.</B>
display SIM-THANKS-01 upon console
display SIM-THANKS-02 upon console
exit.
</FONT><FONT STYLE='font-size: 12px; font-family: "Courier New"; color: maroon'> *****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: [email protected] *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************</FONT></PRE>
<H1> <A NAME="Summary">Summary </A>
<FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#SoftwareAgreementDisclaimer" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#CobolProgramSysinMultiple" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H1>
<P>The purpose of this document is to assist as a tutorial for new
programmers or as a quick reference for experienced programmers. These sample
programs are made available on an "as-is" basis and may be downloaded, copied
and modified for specific situations as long as the copyright information is
not removed or changed. As always, it is the programmer's responsibility to
thoroughly test all programs.</P>
<H2> <A NAME="SoftwareAgreementDisclaimer" STYLE="color: navy">Software
Agreement and Disclaimer </A><FONT FACE="Arial"
STYLE="color: gray; font-size: 8pt; font-weight: normal"><BR>(<A
HREF="#SimilarPoints" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Next</A>) (<A
HREF="#Summary" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'" STYLE="color: gray">Previous</A>) (<A
HREF="#TOC" ONMOUSEOUT="this.style.color='808080'"
ONMOUSEOVER="this.style.color='FF0000'"
STYLE="color: gray">Table-of-Contents</A>)</FONT></H2>
<P>Permission to use, copy, modify and distribute this software for any
commercial purpose requires a fee to be paid to Simotime Enterprises. Once the
fee is received by SimoTime the latest version of the software will be
delivered and a license will be granted for use within an enterprise, provided
the SimoTime copyright notice appear on all copies of the software. The
SimoTime name or Logo may not be used in any advertising or publicity
pertaining to the use of the software without the written permission of
SimoTime Enterprises.</P>
<P>Permission to use, copy, modify and distribute this software for a
non-commercial purpose and without fee is hereby granted, provided the SimoTime
copyright notice appear on all copies of the software. The SimoTime name or
Logo may not be used in any advertising or publicity pertaining to the use of
the software without the written permission of SimoTime Enterprises.</P>
<P>SimoTime Enterprises makes no warranty or representations about the
--> --------------------
--> maximum size reached
--> --------------------
¤ Dauer der Verarbeitung: 0.31 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|