IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

searching and updating particualr record


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Mon Feb 16, 2009 9:26 pm
Reply with quote

I have input file of LRECL=133 where I have got 65 records for every employee having diff information on each record.Out of 65th I need to check 7th record(or 7th line) 34th position of every employee and need to search whether I have same value in Second file .Second file has LRECL =80 but will contain only 4 digit value.If i found same value in 7th record of 1st file present in as that of second file I need to place N on 125th position in 7th record of the first file.I need to search second file because I dont know where the value will be may be at last


For Ex think following line is 7th record of 1st employee and have got 0830 value in 34th position now i need to search whether 0830 value present in second file.If yes I need to Place N in 125th column of same 7th record of an employee
34th Position 125th Position
11889 DOUGLAS DR 0830 0030 053 N


Please let me know code that can perform better?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 16, 2009 11:41 pm
Reply with quote

Quote:

Please let me know code that can perform better?
Code that can perform better than what? You haven't posted anything to say how you're solving the problem already, so there's nothing to compare against.
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Tue Feb 17, 2009 8:18 pm
Reply with quote

Robert,

Sorry I mean to say I want code in an effective way and I currently dont have any code.Please let me know your ideas on the same
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Tue Feb 17, 2009 9:20 pm
Reply with quote

I guess your first file is a VSAM . If not create it that way because the performance wil be too good. Create the key in such a way that for a particular employee u can identify all the 65 records independently.

Using the key read the first file and then perform your required operation...
It would be good if you could specify the second file as VSAM too.

REMEMBER to open our ur first file in I-O mode...and take file backups before running the programs
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Tue Feb 17, 2009 9:52 pm
Reply with quote

No Its not a vsam File kishore and its very difficult to have it as VSAM since each record of an employee is not having anything unique in all records.....
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Tue Feb 17, 2009 10:48 pm
Reply with quote

if that is the case how do u identify to which employee a particular record belongs if there is not anything common...

if its not a VSAM create a temp VSAM and load the flat file to that....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Feb 18, 2009 5:09 am
Reply with quote

Read all 65 records into an array, then use reference modification to identify the appropriate fields to access and change. You can then write all 65 array elements to your output file. I don't think you can do this without having an input file and an output file unless you change the file from sequential to VSAM.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 18, 2009 5:33 am
Reply with quote

Hello,

Quote:
I don't think you can do this without having an input file and an output file unless you change the file from sequential to VSAM.
Even if you could, you would be better off not. . . An abend could corrupt the input requiring it be rebuilt. If you write to a separate qsam file, there is no risk to the orginal input.
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Wed Feb 18, 2009 1:31 pm
Reply with quote

we can have a different approach.....using the VSAM itself...


1. Use VSAM in I/P mode
2. create the sequential O/P
3. REPRO to the VSAM(if required as ur i/p file is PS)

In this case the proceess is faster and VSAM rebuiliding is not required in case of an abend is not there.
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Fri Feb 20, 2009 9:23 pm
Reply with quote

I have input file of LRECL=133 where I have got 65 records for every employee having diff information on each record.Out of 65th I need to check 7th record(or 7th line) 34th position of every employee and need to search whether I have same value in Second file .Second file has LRECL =80 but will contain only 4 digit value.If i found same value in 7th record of 1st file present in as that of second file I need to place N on 125th position in 1st record of the first file.I need to search second file because I dont know where the value will be,it may be at last also.

Remember I need to update in First record based on values of 7th record and second file value


For Ex think following line is 7th record of 1st employee and have got 0830 value in 34th position now i need to search whether 0830 value present in second file.If yes I need to Place N in 125th column of 1st record of every employee(not in the same 7th records but 1st record)

11889 DOUGLAS DR 0830 0030 053 N
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Feb 20, 2009 9:25 pm
Reply with quote

Have you looked at this: www.ibmmainframes.com/viewtopic.php?t=38137&highlight=
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Fri Feb 20, 2009 9:37 pm
Reply with quote

Yes, But here requirement is changed and I want to update the 1st record and not 7th record.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Feb 20, 2009 11:49 pm
Reply with quote

First record, 7th record, 65th record ... it doesn't matter. The same basic method is used. Read all records into an array, do what you want using the array, then output all the array elements to your file.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Feb 21, 2009 1:40 am
Reply with quote

Hello,

Any more discussion should be posted n the original topic (link above).

Changing which record is not a requirement change, , , It is just a duplicate post.

d
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Sat Feb 21, 2009 10:14 pm
Reply with quote

It will be more helpfull if i can get syntax for the following.

I want to read 65 records of lrecl 150 each from a input flat file until employee number changes and need to store it in an array.after storing I need to retrieve piece of data from 7th record and need to search in a table if same value present in table also i need to retreive 1st record from array and need to update 125th position and need to write full 65 records to output file and need to proceed with second 65 records for an second employee like wise till the end of first input file
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Feb 21, 2009 10:23 pm
Reply with quote

Hello,

Quote:
It will be more helpfull if i can get syntax for the following.
Actually, it will be more help for you to write the code and learn by so doing.

Your description says what you want to do, so you need to put the code in place:
Define the files and the array.
Write the code to read the file and put the records for an employee into the array.
Perform a routine to work with the employee in the array (don't forget to process the array one more time at eof so the last employee will be processed).
Once the array has been processed, write the updated array entries to a new output file.

If you get stuck, post what you have and your question. Someone will be able to help.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 21, 2009 10:23 pm
Reply with quote

Quote:
It will be more helpfull if i can get syntax for the following.
And it will be more helpful if I get paid my daily rate to do your job for you. Read the manuals and write the program, or plan on paying somebody to write your code for you.
Back to top
View user's profile Send private message
gopinathmk

New User


Joined: 17 Nov 2006
Posts: 15

PostPosted: Sat Feb 21, 2009 10:26 pm
Reply with quote

Can DFSORT help me in doing following:

1) Input file with LRECL=140 will have 65 records for each employee and can have several employees like wise and each employee with 65 records

2)second input file with lrecl=80 but got data only in first 4 columns(i.e Pic X(4))


Now i need to search 4 columns from 34th position of 7th record out of 65 records of each employee and I need to search whether same 4 digit value present in second input file.If Yes I need to update 125th position of 1st record of 65 records of every employee and need to write all 65 records to output file if value doesnt found in input file i need to write whole 65 records without updating any record. Like wise this should continue till last employee in input file
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 21, 2009 10:32 pm
Reply with quote

Let's see -- you didn't get somebody to write your program for you in the COBOL forum, so now you're going to try in the SORT forum ... wanna bet it doesn't work here, either?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Feb 21, 2009 10:39 pm
Reply with quote

You have asked the same general question three times.
First as a Syncsort question that got moved to COBOL, second as a COBOL question and third as a DFSort question.
Wht kind of solution are you looking for?
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sat Feb 21, 2009 11:19 pm
Reply with quote

Dear All

Can we all be a little more polite with the language we use.....agreed that many a time a lot of us want to get the job done in an easy way....but in the same breath I wish to add that nobody has forced anyone of us to join the forum and help others....we all are here to help each other out when one get's stuck...

...and also we must continue to toil and ask for codes only when one needs a parachute.....self-learning is the best way to move forward....

...a note of thanks to all the people who are continuously lending a helping hand...

Cheers....
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Feb 21, 2009 11:27 pm
Reply with quote

ykishor wrote:
Can we all be a little more polite with the language we use.....
I'm sorry, I do not understand, but just what did you find less than "polite"?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Feb 21, 2009 11:36 pm
Reply with quote

Hello,

It won't work here as i'm locking the topic and relocating it and will issue a formal warning if this shows up again. . . In any part of the forum. . .

If any amount of time had been spent working on the reuirement rather than trying to get others to do the work, it would be done now. It has only been 5 days or so. . .
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sun Feb 22, 2009 12:12 am
Reply with quote

to CICS Guy:

Quote:
And it will be more helpful if I get paid my daily rate to do your job for you. Read the manuals and write the program, or plan on paying somebody to write your code for you.


I too am confused if this the way we converse at a professional forum...by the way the query posted in this thread is not mine...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sun Feb 22, 2009 12:14 am
Reply with quote

Raw code is about 200 lines of COBOL without error checking (I wrote the program this afternoon to verify that). Surely even a complete COBOL novice can write a couple hundred lines of code in 5 days -- allowing for some testing as well -- which means the code could have been completed by now if the original poster had just coded up the program instead of trying for days to get somebody to do it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top