Produce a multiplication times table for some training



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Produce a multiplication times table for some training

Postby Sanjana » Sat Dec 10, 2016 11:56 am

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
Sanjana
 
Posts: 11
Joined: Sat Dec 10, 2016 11:42 am
Has thanked: 0 time
Been thanked: 0 time

Re: Produce a multiplication times table for some training

 

Re: Produce a multiplication times table for some contest

Postby BillyBoyo » Sat Dec 10, 2016 2:37 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 263 times

Re: Produce a multiplication times table for some contest

Postby prino » Sat Dec 10, 2016 2:39 pm

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?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 520
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 19 times

Re: Produce a multiplication times table for some contest

Postby NicC » Sat Dec 10, 2016 5:59 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2662
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 100 times

Re: Produce a multiplication times table

Postby Sanjana » Tue Dec 13, 2016 5:46 pm

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
/*
Sanjana
 
Posts: 11
Joined: Sat Dec 10, 2016 11:42 am
Has thanked: 0 time
Been thanked: 0 time

Re: Produce a multiplication times table for some contest

Postby NicC » Tue Dec 13, 2016 7:58 pm

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'.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2662
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 100 times

Re: Produce a multiplication times table for some contest

Postby enrico-sorichetti » Tue Dec 13, 2016 8:19 pm

the original title was
Produce a multiplication times table for some contest

now it' s training

anyway the proper definition is cheating :evil:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2582
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 123 times

Re: Produce a multiplication times table for some contest

Postby BillyBoyo » Tue Dec 13, 2016 11:09 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 263 times

Re: Produce a multiplication times table for some contest

Postby BillyBoyo » Wed Dec 14, 2016 12:00 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 263 times

Re: Produce a multiplication times table

Postby Sanjana » Wed Dec 14, 2016 6:21 pm

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.
Sanjana
 
Posts: 11
Joined: Sat Dec 10, 2016 11:42 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post