Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to use 2 input files in control control card
Goto page 1, 2  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 3:42 pm    Post subject: How to use 2 input files in control control card
Reply with quote

I've a requireent, I have done some research with help of google but couldn't get any proper solution, could some one help me on!

Requirement: There are 3 datasets,dataset1 : is having one key row(Value1/Value2/value3). Datasets2/3/4: have data i.e many records which need to be write into the output/another dataset based on value present in first dataset key.

Suppose - case 1: if dataset1.value = Value1 then write dataset2 records into another/output dataset. Case 2: if dataset1.value = Value2 then write dstaset3 records into another/output dataset. Case 3: if dataset1.value = Value3 then write dataset4 records into another/output dataset.

Seems like using RC code, we can achive above requiremnt but not sure until i test. hence if anyone knows any other way of doing it, please help me icon_smile.gif

Editd - changed 'file' to 'dataset' many times. corrected spelling
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1714
Location: UK

PostPosted: Thu Oct 13, 2016 4:22 pm    Post subject:
Reply with quote

Your requirement is not particularly clear. I can guess but we do not deal in guesses. Show us example data of what you mean - using the code tags to preserve spacing.
Don't know how to use the code tags? Search the forum or, more easily, use the full editor for your post.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Oct 13, 2016 5:45 pm    Post subject:
Reply with quote

Gunapala CN,

Welcome to the forums! How many output files ('another/output dataset') do you have? As suggested by Nic, use "Code" tags in the editor to post sample data and/or JCL. You can use the preview button to make sure it looks the way you expect, before submitting.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 13, 2016 6:19 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

Quote:
I can guess but we do not deal in guesses.


Psychic day was yesterday, the TS will have to wait until next wednesday icon_cool.gif
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 7:56 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

Thanks for all your time.

sorry for putting plain problem statement in front of you!

My requirement would be like below -

File1 will be having data/record :OFF/ON/TRIAL
File 2 will be having records eg :AAAAAAAA and many more
File3 will be having records eg: BBBBBBBB and many more
File 4 will be having records eg:CCCCCCCC and many more
File 5 will be the Output file :

what i need to here is that :

if File1 record = OFF
File 2 data is need to populate into Output file i.e. File5
else If File1 record =ON
File 3 data is need to be populate into the same File5 file
else
if File1 Record = TRAIL
File4 data is need to be populate into the same File5 file.
end if

Note : i know this scenarios we can handle it in Cobol but we would like try wthr its possible do it with complete JCL/SORT CARDS help. Also with help of RC(return codes , explicit SET in previous step based on condition) we can achieve. we are trying out this.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 13, 2016 8:15 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

is this some kind of a joke icon_eek.gif
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 65
Location: India

PostPosted: Thu Oct 13, 2016 8:32 pm    Post subject: Re: Reply to: How to use 2 input files in control control card
Reply with quote

Hello,

Gunapala CN wrote:
...
Note : i know this scenarios we can handle it in Cobol but we would like try wthr its possible do it with complete JCL/SORT CARDS help. Also with help of RC(return codes , explicit SET in previous step based on condition) we can achieve. we are trying out this.


Not sure if this is an assignment or an actual PRODuction scenario, if it is, then whoever thought of an all *SORT solution is off their pills.

Fwiw, because you haven't defined any specific rules for this task- well, here goes nothing:

a. Have a simple SORT FIELDS=COPY for FILE1 (and it is dataset, not file), have 3 OUTFIL statements for your OUTPUT dataset.
b. In each OUTFIL statement test using INCLUDE for the flags you have in FILE1.
c. If the respective flag matches, write a simple JCL in that OUTFIL, using BUILD, within this JCL, override the dataset names- you can either hard-code the name, or go a step ahead and use SYMNAMES here and pass symbolic values for DSNs you want.
d. Route the 3 OUTFIL DS to INTRDR in SORTOUT DD names.

Now, what is going to happen is, depending on WHAT your flag value is, a fresh JCL will be created and submitted, within which DS2 to DS5 and so on will get processed - individually.

Like I'd said earlier - you didn't define the rules clearly here, so this solution does get the job done - fairly easily. icon_razz.gif
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 9:15 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

Thank you so much Abid Hasan icon_smile.gif

Approch which you have suggested looks great to me. Thanks for all your suggestions

Kind Regards
Gunapal
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 9:16 pm    Post subject: Re: Reply to: How to use 2 input files in control control card
Reply with quote

enrico-sorichetti wrote:
is this some kind of a joke icon_eek.gif


Not really!!
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 159
Location: Chennai

PostPosted: Thu Oct 13, 2016 9:36 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

Assuming

Your Header or FILE1 has

Code:

----+----1----+----2
ON                 


OR

Code:

----+----1----+----2
OFF


OR

Code:

----+----1----+----2
TRAIL


And assuming LRECL=80

you may try below code.

Code:

//STEP01  EXEC PGM=SORT                                     
//SORTIN  DD DSN=FILE1,DISP=SHR                             
//        DD *                                               
FILE2                                                       
//        DD DSN=FILE2,DISP=SHR                             
//        DD *                                               
FILE3                                                       
//        DD DSN=FILE3,DISP=SHR                             
//        DD *                                               
FILE4                                                       
//        DD DSN=FILE4,DISP=SHR                             
//SORTOUT DD DSN=FILE5,DISP=(,CATLG,DELETE),SPACE=(CYL,(10,10),RLSE)
//SYSOUT  DD SYSOUT=*                                       
//SYSIN   DD *                                               
  OPTION COPY
                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'OFF',OR,       
                            1,2,CH,EQ,C'ON',OR,             
                            1,5,CH,EQ,C'TRAIL'),             
                           PUSH=(81:1,5)),
                   
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE2'),       
                           PUSH=(86:1,5)), 

        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE3'),       
                           PUSH=(86:1,5)),   
               
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE4'),       
                           PUSH=(86:1,5)) 
                 
  OUTFIL INCLUDE=(1,5,SS,NE,C'FILE2,FILE3,FILE4',AND,       
                  1,3,CH,NE,C'OFF',AND,                     
                  1,2,CH,NE,C'ON',AND,                       
                  1,5,CH,NE,C'TRAIL',AND,                   
         (81,10,SS,EQ,C'OFF  FILE2,ON   FILE3,TRAILFILE4')),

         BUILD=(1,80)                                       
                                                             
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 159
Location: Chennai

PostPosted: Thu Oct 13, 2016 9:48 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

Note: I have used FILE2, FILE3, FILE4 as instream data, because I don't know whether you have a unique identifier for each file.

If you have the unique identifier for each file, then you may use that in IFTHEN=(WHEN=GROUP,BEGIN/KEYBEGIN=.. and remove FILE1,FILE2,FILE3 instream data
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 13, 2016 10:03 pm    Post subject: Reply to: How to use 2 input files in control control card
Reply with quote

what a shameful waste of resources !
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 10:36 pm    Post subject: Re: Reply to: How to use 2 input files in control control card
Reply with quote

magesh23586 wrote:
Assuming

Your Header or FILE1 has

Code:

----+----1----+----2
ON                 


OR

Code:

----+----1----+----2
OFF


OR

Code:

----+----1----+----2
TRAIL


And assuming LRECL=80

you may try below code.

Code:

//STEP01  EXEC PGM=SORT                                     
//SORTIN  DD DSN=FILE1,DISP=SHR                             
//        DD *                                               
FILE2                                                       
//        DD DSN=FILE2,DISP=SHR                             
//        DD *                                               
FILE3                                                       
//        DD DSN=FILE3,DISP=SHR                             
//        DD *                                               
FILE4                                                       
//        DD DSN=FILE4,DISP=SHR                             
//SORTOUT DD DSN=FILE5,DISP=(,CATLG,DELETE),SPACE=(CYL,(10,10),RLSE)
//SYSOUT  DD SYSOUT=*                                       
//SYSIN   DD *                                               
  OPTION COPY
                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'OFF',OR,       
                            1,2,CH,EQ,C'ON',OR,             
                            1,5,CH,EQ,C'TRAIL'),             
                           PUSH=(81:1,5)),
                   
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE2'),       
                           PUSH=(86:1,5)), 

        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE3'),       
                           PUSH=(86:1,5)),   
               
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'FILE4'),       
                           PUSH=(86:1,5)) 
                 
  OUTFIL INCLUDE=(1,5,SS,NE,C'FILE2,FILE3,FILE4',AND,       
                  1,3,CH,NE,C'OFF',AND,                     
                  1,2,CH,NE,C'ON',AND,                       
                  1,5,CH,NE,C'TRAIL',AND,                   
         (81,10,SS,EQ,C'OFF  FILE2,ON   FILE3,TRAILFILE4')),

         BUILD=(1,80)                                       
                                                             


Thank you Magesh icon_smile.gif I will try out with my Test data.. Thanks for your time.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Oct 13, 2016 10:49 pm    Post subject:
Reply with quote

Welcome!!
1.You could have finished coding + testing in 1 hour, if you have done through COBOL or any other known language to you and whoever forcing you to do through DFSORT should be asked for justifications else should quit the job.
2.Now coming to your original post, (Value1/Value2/value3) are they mutually exclusive? if so then you can set the RC accordingly (which you already know/told) in previous step and in next step you can pick dataset based on RC.
3.Abid Hasan has a nice suggestion too but why make things complex when you know COBOL is easiest and simple to code and maintain.
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 11:05 pm    Post subject:
Reply with quote

Hello Rohit sir,

Fantastic!!

I agree with you, this is not forced do it from some one! Just I am curious to know any other way of doing it.

As you told we can do it by having RC code set in previous step since those three values are constant always. Actually those I'm fetching from table in previous step by passing key and these are expect to be same all time.

Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.

Anyway thanks for your time and suggestions.

Regards
Gunapal
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Oct 13, 2016 11:23 pm    Post subject:
Reply with quote

Gunapala CN wrote:
Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.
I don't know how you arrived at such a 'conclusion'. Reading a one record data set and issuing a return-code/copying other files is so difficult to maintain and implement in COBOL? May be the definition of 'easy' for you might be different from the vast majority. Did you realize that the DFSORT 'solution' is processing through all the 3 input data sets, where your original requirement was to copy only one of these? And you '#ignore' waste of resources. Good luck. icon_smile.gif

"When all you have is a hammer, everything looks like a nail"
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Thu Oct 13, 2016 11:44 pm    Post subject:
Reply with quote

Arun Raj wrote:
Gunapala CN wrote:
Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.
I don't know how you arrived at such a 'conclusion'. Reading a one record data set and issuing a return-code/copying other files is so difficult to maintain and implement in COBOL? May be the definition of 'easy' for you might be different from the vast majority. Did you realize that the DFSORT 'solution' is processing through all the 3 input data sets, where your original requirement was to copy only one of these? And you '#ignore' waste of resources. Good luck. icon_smile.gif


Yup Agreed!! Regarding 'conclusion' process which follow to new amendments to existing modules and jcls are likely to be different and it's different across project to project... Anyway the topic is not that here...

But few ppl responses to the request is seems to be not fine because you can't decide someone capability just like that and none of our job here.. Ppl can ignore such request which incomplete or may ask for repost it rather than talking in bad manner. Also I understand other ppl time so I alway gfeatful for that!
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Oct 13, 2016 11:51 pm    Post subject:
Reply with quote

Don't take it personally Gunapala but people here have tremendous knowledge and hands on and based on that they comment and advise so if we are at the receiving end of the HELP then one should be submissive and obliged by accepting the way they advise us and most importantly take that in positive way. Btw, COBOL is easy for maintenance than anything. I see this topic is getting locked soon.
Back to top
View user's profile Send private message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Fri Oct 14, 2016 12:11 am    Post subject:
Reply with quote

Rohit Umarjikar wrote:
Don't take it personally Gunapala but people here have tremendous knowledge and hands on and based on that they comment and advise so if we are at the receiving end of the HELP then one should be submissive and obliged by accepting the way they advise us and most importantly take that in positive way. Btw, COBOL is easy for maintenance than anything. I see this topic is getting locked soon.


Hi Sir

You are right, Yes i've got many approaches to do my tasks now. I'm sure at least one of those will work out esle I will go with cobol which is completely easy to me as well.

Thanks a lot.. Soon will be comming with new doubts with complete information icon_razz.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Oct 14, 2016 12:18 am    Post subject:
Reply with quote

Quote:
Soon will be comming with new doubts with complete information
Thanks and always Welcome!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 1 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us