Mainframe - How to create several datasets using a loop (conditional programming)

I'm a newbie at the mainframe and all the terms are confusing.  
Just the fact that in submitting a job you can have jcl, sas and cobol together and then you have a whole bunch of mainframe utilities..... "can anyone say confusing".

My Question:
Mainframe - How to create several datasets using a loop (conditional programming)
What do I need to use JCL, Cobol....

so when I run it I can assign a number say 10 for example:


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

i do not know much about main frames but the algorithm can be very simple
DataSet[] myResults = new DataSet[MAX_POSSIBLE_DATASET];
loop condition here
for(int i=0; i < MAX_POSSIBLE_DATASET; i++)
myResults[i] = GetResultDataSet(i);

This might not exactly work for you but just to give you an idea, you can use an array/list for the job.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JCL is very basic and has looping capabilities.

If you have SAS you can do this.  Do you have access to batch TSO and REXX?  

However, is there a special reason why you need to have these files pre-allocated?

sch626Author Commented:
I was asking for JCL code and I didn't get any..
That is because you can't do it in JCL.  JCL is not a programming language.  You need a scripting/programming language, such as REXX, TSO Clist, Assembler, or SAS.

REXX, TSO Clist, or SAS would be the easiest and in that order.

If you still need to do this, you need to let us know what scripting/programming languages you have access to.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Mainframe OS

From novice to tech pro — start learning today.