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
 

 

Need a not matching logic to write to output file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Mon Dec 10, 2007 11:28 pm    Post subject: Need a not matching logic to write to output file
Reply with quote

Hi,

I have a requirement as follows.

input file 1
------------
emp-no
emp-name


input file2
------------
emp-no
emp-status
emp-state

output file
------------
emp-no
emp-name
emp-status
emp-state

Requirement
---------------

If emp-no from file1 is not equal to emp-no of file2
the following fields will be wriiten to output
emp-no from input file 1
emp-name from input file1
emp-status and emp-state from file2

both the input files are sorted based on emp-no

Please advice how to write the record as shown in output file...

Thanks in advance
shakti
Back to top
View user's profile Send private message

Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Tue Dec 11, 2007 3:54 am    Post subject:
Reply with quote

Hi Shakti,

Quote:
If emp-no from file1 is not equal to emp-no of file2
the following fields will be wriiten to output
emp-no from input file 1
emp-name from input file1
emp-status and emp-state from file2


If emp-no of file1 and 2 doesn't match, which record from file2 should be used to take emp-status and emp-state??
Back to top
View user's profile Send private message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Tue Dec 11, 2007 6:48 am    Post subject:
Reply with quote

Hi Ramya,

I would like to write the file2(Currently not matched) fields of emp-state and emp-status if emp-no of file 1 and 2 doesn't match.

Hope this will helps to understand my requirement.

Thanks and regards,
Shakti
Back to top
View user's profile Send private message
kunalgala

New User


Joined: 11 Dec 2007
Posts: 1
Location: India

PostPosted: Tue Dec 11, 2007 12:03 pm    Post subject:
Reply with quote

Hi Shakti...
The logic as per my understanding of your requirement is as follows:
The following para is to be called in loop until either of the file end is reached.

PROCESS-PARA.
READ FILE1 AT END..
READ FILE2 AT END ...
IF FILE1 AND FILE NOT AT END.....
IF EMP-NO in FILE1-REC NOT = EMP-NO IN FILE2-REC
MOVE EMP-NO IN FILE1-REC TO EMP-NO IN OUTFILE-REC
MOVE emp-name IN file1-REC TO EMP-NAME IN OTFILE-REC
MOVE emp-status IN FILE2-REC TO emp-status IN OUTFILE-REC
MOVE emp-state IN FILE2-REC TO EMP-STATE IN OUTFIILE-REC

(Note .... implies the required logic is not entioned here)

Hope this helps...
Back to top
View user's profile Send private message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Tue Dec 11, 2007 3:23 pm    Post subject:
Reply with quote

Hi,

I tried this option too. But getting invalid file reference field error...

Any easytrieve suggestion is highly appriceated.

Thanks
Shakti
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Dec 11, 2007 3:52 pm    Post subject:
Reply with quote

Hi,

Your post is in CA-products forum..so I'm bit not sure whether you would like to do it using COBOL or SORT. However if COBOL, there is A "sticky" in COBOL forum that can be useful for you...here is the link..

If SORT, a JOB like this can be handy,

Code:
//DFSORT  EXEC PGM=ICETOOL                                             
//TOOLMSG DD SYSOUT=*                                                 
//DFSMSG  DD SYSOUT=*                                                 
//IN1     DD DSN=HLQ.FIRST.FILE,DISP=(SHR,KEEP,KEEP)               
//IN2     DD DSN=HLQ.SECOND.FILE,DISP=(SHR,KEEP,KEEP)             
//TMP1    DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT     DD DSN=HLQ.OUT.FILE1,DISP=(NEW,CATLG,CATLG)             
//TOOLIN  DD *                                                         
  COPY FROM(IN1) TO(TMP1) USING(CPY1)                                 
  COPY FROM(IN2) TO(TMP1) USING(CPY2)                                 
  SPLICE FROM(TMP1) TO(OUT) ON(1,3,CH) WITH(11,5)                     
//CPY1CNTL DD *                                                       
  OUTREC FIELDS=(1:1,3,5:5,5,11:5X)                                   
/*                                                                     
//CPY2CNTL DD *                                                       
  OUTREC FIELDS=(1:1,3,11:5,5)                                         
/*                                                                     


In above JCL contents of inputs & ouputs are:
HLQ.FIRST.FILE
Code:
111 $$$$$
222 AAAAA
444 FFFFF
555 GGGGG
888 CCCCC


HLQ.SECOND.FILE
Code:
111 BBBBB
333 DDDDD
444 FFFFF
555 HHHHH

HLQ.OUT.FILE1
Code:
111 $$$$$ BBBBB
444 FFFFF FFFFF
555 GGGGG HHHHH
Back to top
View user's profile Send private message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Tue Dec 11, 2007 4:18 pm    Post subject:
Reply with quote

Hi Anuj,

Thanks for ur suggestion.
But i wanted to do it using easytrive.

thanks much
Shakti
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Dec 19, 2007 10:55 pm    Post subject:
Reply with quote

Hi,

I do not use easytrive so can not provide the code right away..However it should have a COBOL like pseudo code, there is a "sticky" in COBOL forum that can be useful for you as far as pseuo code is concern...here is the link..
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Dec 20, 2007 2:08 am    Post subject:
Reply with quote

Easytrieve is very good for file matching. "invalid file reference field error" is usually the result of using variables from one file when you have a non-match condition and you are processing a record from the other file. If you show us your matching logic including the statement the error is on we could help you find the problem.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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