View previous topic :: View next topic
|
Author |
Message |
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
ykishor Currently Banned New User
Joined: 11 Aug 2007 Posts: 24 Location: my pc
|
|
|
|
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 |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
ykishor Currently Banned New User
Joined: 11 Aug 2007 Posts: 24 Location: my pc
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ykishor Currently Banned New User
Joined: 11 Aug 2007 Posts: 24 Location: my pc
|
|
|
|
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 |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
Back to top |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
Yes, But here requirement is changed and I want to update the 1st record and not 7th record. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
gopinathmk
New User
Joined: 17 Nov 2006 Posts: 15
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
ykishor Currently Banned New User
Joined: 11 Aug 2007 Posts: 24 Location: my pc
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ykishor Currently Banned New User
Joined: 11 Aug 2007 Posts: 24 Location: my pc
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|