Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need a logic, where the variable should be mapped

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Need a logic, where the variable should be mapped
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

Site Director


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

PostPosted: Fri Nov 04, 2011 12:45 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 04, 2011 12:47 am    Post subject: Reply to: Need a logic
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: 8593
Location: Back in jolly old England

PostPosted: Fri Nov 04, 2011 12:50 am    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 04, 2011 12:52 am    Post subject: Reply to: Need a logic
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 04, 2011 12:54 am    Post subject: Reply to: Need a logic
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: 1738
Location: Bloomington, IL

PostPosted: Fri Nov 04, 2011 12:55 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 04, 2011 12:57 am    Post subject: Reply to: Need a logic
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

Site Director


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

PostPosted: Fri Nov 04, 2011 12:57 am    Post subject: Reply to: Need a logic
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 04, 2011 1:00 am    Post subject: Reply to: Need a logic
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    Post subject:
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

Site Director


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

PostPosted: Fri Nov 04, 2011 1:20 am    Post subject: Reply to: Need a logic
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    Post subject:
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

Site Director


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

PostPosted: Fri Nov 04, 2011 1:35 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 04, 2011 1:36 am    Post subject: Reply to: Need a logic
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: 176
Location: Pune, Maharashtra, India

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

Requirement should have been posted correctly.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Nov 07, 2011 9:38 pm    Post subject: Reply to: Need a logic
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us