How to write - 'Hello world' program through JCL

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
pal.sanjay.k
Member
Posts: 3
Joined: Sat Jun 18, 2011 2:33 pm

How to write - 'Hello world' program through JCL

Post by pal.sanjay.k » Sat Jun 18, 2011 2:41 pm

Hi,

Can anyone tell me ?

How to write - 'Hello world' program through JCL by passing 'hello world' as sysin data.

Not by submitting cobol program(having 'Hello world') by JCL.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Jun 18, 2011 7:34 pm

Well, before I answer - would like to know your interpretation about the three letters put together and called "JCL"?
Regards,
Anuj

pal.sanjay.k
Member
Posts: 3
Joined: Sat Jun 18, 2011 2:33 pm

Post by pal.sanjay.k » Sat Jun 18, 2011 11:27 pm

Hi Anuj,
I think u are right. JCL used to submit batch jobs.
But just thought, like we pass parameters('hello world') to the cobol prog, cant we pass 'Hello world' as a stream in JCL.

It will be grateful, if u cud elaborate on this. I am still confused....

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Sun Jun 19, 2011 3:52 am

Pass it to what? For what purpose? What do you want to do with it? Too many questions for what little detail you've provided.

Here's a quick overview of JCL (Job Control Language):

1. You need a JOB statement to identify the job:
//JOBNAME JOB (.......),'NAME',CLASS=,MSGCLASS=,...
as per the job coding standards at your site.

2. You need a job step to execute something, either a program or a JCL procedure:
//STEPNAME EXEC PGM=PROGRAM,PARM='parameters'

or

//STEPNAME EXEC PROCEDURE

3. Then, if your program needs to access data, you need DD statements:
//DDNAME DD DSN=SOME.DATASET,DISP=...
//DDNAME DD SYSOUT=*
//DDNAME DD *
/*

and, for the most part, that's about it.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Mon Jun 20, 2011 9:58 pm

How to write - 'Hello world' program through JCL by passing 'hello world' as sysin data.


FWIW, this DFSORT job will take Hello World from SORTIN DD * (sysin data) and write it to SORTOUT (SYSOUT output).

Code: Select all

//S1 EXEC PGM=SORT        
//SYSOUT DD SYSOUT=*      
//SORTIN DD *             
Hello World               
//SORTOUT DD SYSOUT=*     
//SYSIN DD *              
  OPTION COPY             
/*
If you state more clearly what it is exactly you want to do, I can probably show you how to do it with DFSORT.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Jun 21, 2011 2:26 pm

pal.sanjay.k wrote:I think u are right. JCL used to submit batch jobs.
But just thought, like we pass parameters('hello world') to the cobol prog, cant we pass 'Hello world' as a stream in JCL.
JCL, by it's very definition, is a control language used to identify a job to an operating system and to describe the job's requirement, so by itself does nothing, just aranges the things to get it working.

What you are asking is probably, avoid writing a COBOL, PL/1, C, or Java program - instead use some "utility-program", like Frank has demonstrated, using DFSORT. If so, you've plenty of choices and you already have one working example.
Last edited by Anuj Dhawan on Tue Jul 12, 2011 4:01 pm, edited 1 time in total.
Regards,
Anuj

pal.sanjay.k
Member
Posts: 3
Joined: Sat Jun 18, 2011 2:33 pm

Post by pal.sanjay.k » Sat Jun 25, 2011 10:09 pm

Thanks Anju and MrSpock.

Actually I now realized that i asked a wrong question.
JCL can not be used to WRITE application programs.

Its just used to SUBMIT jobs and in some cases PASSING some parameters to the COBOL programs.

Like in 'C' we do ALT + F9 to compile program. We do Trngcob to compile Cobol prog.
To run progs in C we do CTRL + F9 . We submit JCL job to RUN COBOL prg.

In C after compling we get obj file , which runs in doing ctrl + F9
in Cobol on compilation we get a Load module usually here 'OPERN.CICS3.LOADLIB'.
on submitting JCL the respective Program name whose Load module is loaded at theOPERN.CICS3.LOADLIB gets executed.


Please correct me if I am wrong at any stage.

Thanks Frank for explaining, but sorry i didn't reach at that level...

Waiting for response...


Regards,
Sanjay Kumar.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Jul 12, 2011 4:07 pm

Well, for C, You are talking about as if you'll do it on personal computer at home; and that's not what happens in PROD.

For COBOL, you write a Source-code, compile, link-edit it to get the load module. Load modules get loaded to memory, memory with processor, and not in to some library as you've mentioned.
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others