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

Need a logic, where the variable should be mapped


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Nov 04, 2011 12:36 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Nov 04, 2011 12:45 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Nov 04, 2011 12:47 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Nov 04, 2011 12:50 am
Reply with quote

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
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Nov 04, 2011 12:51 am
Reply with quote

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 icon_cool.gif
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 04, 2011 12:52 am
Reply with quote

I have to ask. Is your Avatar of Che Guevara?

Mr. Bill
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Nov 04, 2011 12:54 am
Reply with quote

Quote:
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN
ANOOPPPPPPPPPPPPP NNNNNNNNNNNNNNNNNNN


how do they fit in the description

the second post just made things more muddy icon_evil.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Nov 04, 2011 12:55 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Nov 04, 2011 12:57 am
Reply with quote

I guess that if the CHE could read the TS posts he would madly turn himself in his grave
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: Fri Nov 04, 2011 12:57 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Nov 04, 2011 1:00 am
Reply with quote

probably the TS is a bit masochist who likes to bashed icon_cool.gif


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
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Nov 04, 2011 1:02 am
Reply with quote

@ 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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Nov 04, 2011 1:20 am
Reply with quote

Great - now there are "Code" tags, but they are not aligned. . . icon_neutral.gif

Oh, well. . . 12.gif

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

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Nov 04, 2011 1:26 am
Reply with quote

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 36_8_13.gif
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: Fri Nov 04, 2011 1:35 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Nov 04, 2011 1:36 am
Reply with quote

icon_redface.gif

my bad, it was just a very quick and very dirty post edit
( most probably irrelevant for the overall logic )
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Mon Nov 07, 2011 4:40 pm
Reply with quote

Requirement should have been posted correctly.
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: Mon Nov 07, 2011 9:38 pm
Reply with quote

Quote:
Requirement should have been posted correctly.
What contribution does this make to the topic icon_confused.gif

Was there any reason for this to be posted?

d
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top