Page 1 of 2

Produce a multiplication times table for some training

PostPosted: Sat Dec 10, 2016 11:56 am
by Sanjana
Hello. I have 2 input files with each file containing numbers from 1 to 12. I have to generate the following output file in this format using sort jcl. Please help
1*1=1
1*2=2
.
.
.
1*12=12
2*1=2
2*2=4
.
.
.
2*12=24
.
.
12*12=144

Re: Produce a multiplication times table for some contest

PostPosted: Sat Dec 10, 2016 2:37 pm
by BillyBoyo
Why would you need two identical files? The information in two identical files is exactly the same as in either one of those files. Is that really part of the specification? If it is, it is either a trick, or the person formulating the question just wasn't thinking at the time, or doesn't really have much of a programming background.

Re: Produce a multiplication times table for some contest

PostPosted: Sat Dec 10, 2016 2:39 pm
by prino
And where are you stuck?

This is a forum for beginners, not a "we do your work for you" one...

And since when do reputable companies allow their employees do completely business-unrelated work?

Re: Produce a multiplication times table for some contest

PostPosted: Sat Dec 10, 2016 5:59 pm
by NicC
JCL cannot do what you want even if it does invoke a sort product. It is the product that will do the work - if it can.
As this is a contest you should not get an answert here - that is like an athlete taking drugs. It is CHEATING. Someone could probably give you a hint - that would be the equivalent of an athlete training.

Re: Produce a multiplication times table

PostPosted: Tue Dec 13, 2016 5:46 pm
by Sanjana
I am a beginner and this question is part of the training.
Yes,there are 2 identical input files and I am expected to produce an output of the above format using sort jcl.

//SYSIN    DD *
  JOINKEYS F1=SORTIN01,FIELDS=(1,2,A)
  JOINKEYS F2=SORTIN02,FIELDS=(1,2,A)
  REFORMAT FIELDS=(F1:1,2,F2:1,2)
  BUILD=(1,2,ZD,MUL,6,2,ZD,3,1,C'*')
  OPTION COPY
/*

Re: Produce a multiplication times table for some contest

PostPosted: Tue Dec 13, 2016 7:58 pm
by NicC
Please use the code tags to present data - spacing is maintained. Without the code tags your sort control cards started in column 1 which is an error. I have coded your last posted and you can now see the control cards start in coulmn 3.
Please refrain from using the term 'sort jcl'. 'Sort JCL' is the JCL that invokes the sort program and defines its data sets (not files). The lines that tell sort what to do in this particular invocation are sort control 'cards'.

Re: Produce a multiplication times table for some contest

PostPosted: Tue Dec 13, 2016 8:19 pm
by enrico-sorichetti
the original title was
Produce a multiplication times table for some contest

now it' s training

anyway the proper definition is cheating :evil:

Re: Produce a multiplication times table for some contest

PostPosted: Tue Dec 13, 2016 11:09 pm
by BillyBoyo
Well, I made up the title after it was tail-gated to an old topic. There seem to be some Master the Mainframes questions around, so I did 1+1=mypreferredanswer.

Re: Produce a multiplication times table for some contest

PostPosted: Wed Dec 14, 2016 12:00 am
by BillyBoyo
Sanjana,

You are never going to need to process two identical files using JOINKEYS, so it is pretty poor training. You haven't shown input, but if it is indeed 1 to 12 not 01 to 12, you will not get what you hoped for.

I don't know where you got 6,2 from: your second field on the REFORMAT record is at 3,2.

You need, field, symbol, field, symbol, then result of calculation. With whatever formatting you are supposed to have.

Your input is already in sequence, so look at how to tell JOINKEYS not to sort the data.

You'll get a 1-1 match, you want something which gives you 12 matches for each F1 record, ie all on second file matching all on first. Look at how to do a "cartesian join".

I'd do it just with one input, using OUTFIL repeat, with a sequence number restarting on the key.

Re: Produce a multiplication times table

PostPosted: Wed Dec 14, 2016 6:21 pm
by Sanjana
Well, I made up the title after it was tail-gated to an old topic

I did not give the title for this post. There is no contest. I came across this website and thought someone could guide me.

Yes the input files have numbers from 00 to 12 and if I use a cartesian join how am i supposed to give the key? Both files are identical and has no unique keys.