MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert a new record based on condition - Sync sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
mahesh_chv
Beginner


Joined: 04 Aug 2005
Posts: 41
Topics: 16

PostPosted: Tue Mar 01, 2011 5:12 am    Post subject: Insert a new record based on condition - Sync sort Reply with quote

Hi,

My requirement was similar to the below post
http://www.mvsforums.com/helpboards/viewtopic.php?t=9818&highlight=insert+record

But a slight change....

say I have a input file ( LRECL=200)

AAAA
BBBB
CCCC

now I have to insert a record if 'DDDD' is not there in my input file.

Can some help me out
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Mar 01, 2011 3:33 pm    Post subject: Reply with quote

Suggest you show some realistic sample input data and the output you want when this is processed.
_________________
All the best,

di
Back to top
View user's profile Send private message
mahesh_chv
Beginner


Joined: 04 Aug 2005
Posts: 41
Topics: 16

PostPosted: Tue Mar 01, 2011 10:44 pm    Post subject: Reply with quote

Papadi,

Here is the sample input data....

123AAA
345BBB
567CCC
789EEE


now i have to check my input file if 'DDD' is present.( where AAA,BBB,CCC,DDD are the keys)

If its not present , I need to insert it....

now my output looks like


123AAA
345BBB
567CCC
123DDD
789EEE


The below code works only when a matching record is present

//SYSIN DD *
OPTION COPY
OUTFIL IFTHEN=(WHEN=(3,3,CH,EQ,C'DDD'),
BUILD=(1,6,/,1:1,3,4:C'DDD'))
//*


instead of giving EQ if i specify WHEN=NONE ...it will insert multiple records

But my requirement is to insert if its not present.


We have ICETOOL in our shop........
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Mar 01, 2011 11:34 pm    Post subject: Reply with quote

Is the input going to contain only 4 or 5 records (as shown)? I suspect that this is not a very representative set of sample data. . .

When the DDD record is inserted, how was the 123 chosen - why not 321 or whatever?

It may help if you explain the file content and what is to be accomplished by inserting the DDD record.
_________________
All the best,

di
Back to top
View user's profile Send private message
mahesh_chv
Beginner


Joined: 04 Aug 2005
Posts: 41
Topics: 16

PostPosted: Wed Mar 02, 2011 2:09 am    Post subject: Reply with quote

Papadi,

INput file contains around 3000 records with 200 LRECL


my requirement is to build and insert a new record if its not found (key is not found) ......
I can take care of the Building part .... I need help in the IFTHEN=(WHEN) part.....
how do you code the condition???

Thanks,
Mahesh
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Wed Mar 02, 2011 1:25 pm    Post subject: Reply with quote

You did not answer all the questions - how is "123" chosen?

If the file can contain thousands of records, the sample input posted is not enough to work with. SHow a more reasonable set of input and the output you want from the new sample input. Clearly explain the rules that control creation of the output.
_________________
All the best,

di
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group