View previous topic :: View next topic
|
Author |
Message |
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi all
I have a file like this
Code: |
---key------------------ ----variable--
CCCOOOOOPPPPPPPP DDHHDHDHHDHDHHDHDHYYYYYYWYW
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNNXXXX
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNNXXXXXGH
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNNXXGCV
|
i NEED TO READ this file and write in out put like this
Code: |
---key------------------ ----variable--
CCCOOOOOPPPPPPPP DDHHDHDHHDHDHHDHDHYYYYYYWYW
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNNXXXXXXXXGHXXGCV
|
where the variable should be mapped to the same key record
can anyone help me plze |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Until you actually provide something useful, no one should try. . . If i see "stuff" and you have not yet provided some explanation of what you are trying to do, it will probably be deleted.
You need to post the rules for getting from your input to your output. Sample data is needed, but so is an explanation of the "rules". People should not need to guess at what you want.
What do you mean by "variable"? What is "the same key record"?
Is there some reason that after being here more than a year, you do not use the Code tag to make your posts more readable? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
it does not seem overly complicated to me ...
given that the input record is key+data
the output record content looks like key+data+data+data
obviously as usual the issue is badly described
( what if there are 20000 records with the same key and the data concatenation overflows the record length )
Code: |
read one record
initialize output record
initialize out_key
read one record
do while not EOF
if rec_key = out_key
update output record ( attach data to the end )
else
write output record ( old )
initialize output record ( new )
initialize out_key ( from rec_key )
read one record
end
write output record (old) |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Perhaps if you might just decide to describe the rules of what needs to happen to get the output from the input as there is no corealation between input to output we can all sit here taking wild guesses and waste everybodies time.
Unless you can be bothered to help others help you then don't be surprised if you get very little help. |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
hello this is my input file
Code: |
---WS-KEY-------------- ----WS-FIELD1--- WS-FIELD-2--
CCCOOOOOPPPPPPPP DDHHDHDHHDHD YYYYYYWYW
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNN XXXX
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNN XXXXXGH
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNN XXGCV |
what i need to do is..the 2nd & 3rd & 4 th record has same key but differnt WS-FIELD2. I need to create an out put record so that the WS-KEY mapped to the three WS-FIELD-2
like below
Code: |
---WS-KEY-------------- ----WS-FIELD1--- WS-FIELD-2 ws-field3---ws-fild3
CCCOOOOOPPPPPPPP DDHHDHDHHDHD YYYYYYWYW
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNN XXXX XXXXXGH XXGCV
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN |
c /slack/lazy/
I was not |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I have to ask. Is your Avatar of Che Guevara?
Mr. Bill |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN |
how do they fit in the description
the second post just made things more muddy |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
I believe, comrade, that Dr. Sorichetti successfully deduced your desires and gave you the pseudo-code. I believe that you are also well aware of what will happen if you demand that the COBOL be written for you. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
I guess that if the CHE could read the TS posts he would madly turn himself in his grave |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
And is still not willing to use the code tag. . .
I'm tempted to just delete the entire topic. . .
If people are unwilling/unable to describe the rules and post their data properly, maybe we don't need the topic. . .
Thoughts - suggestions?
d |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
probably the TS is a bit masochist who likes to bashed
small correction to the pseudo code posted :
key = ws-key + ws-field1
does not change the overall logic, just the building of the rec_key/out_key |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
@ Akatsukami ..You are right actually i added my second post before i read Enrico's reply Thanks Enrico
@Bill..yes its Che
@Enrico..Thanks..the last two lines was added by mistake.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Great - now there are "Code" tags, but they are not aligned. . .
Oh, well. . .
d |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi Dick
Yes i got my mistake....i didn't prepare well before i make the post...
I will make sure i use code tags next time
Thanks all |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Do be aware that there is a Preview function so you can see your post as it will appear to the forum. When the post is as you wish, then Submit. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
my bad, it was just a very quick and very dirty post edit
( most probably irrelevant for the overall logic ) |
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
Requirement should have been posted correctly. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Quote: |
Requirement should have been posted correctly. |
What contribution does this make to the topic
Was there any reason for this to be posted?
d |
|
Back to top |
|
|
|