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

Program logic help on building code/psudocode


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

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Sun Feb 06, 2011 4:05 pm
Reply with quote

Hi,

I am little confused about below requirement and need help on building code/psudocode. The requirement is as below

1: File 1 acct-range (account ranges file) contains are as below 9onle 2 records)
0011000 0059999
0081000 0099999

2: File 2 data file ( details files)

Logic required

Want to read file 1 and aslo want to read file 2
If the the accounts matches with account in data file then populates details from details file and create reports with cretain condition.

Please help me to build above logic with with sample code or some way.

Note both the files have key variable of same length.

Regards,
Nilesh
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Sun Feb 06, 2011 6:27 pm
Reply with quote

it' s sunday and I am in a good mood ...

let' s assume that each record of file1 contains a range
lets call
recd the key of the record to be processed ( file2 )
key1 and key2 the two keys present in each record of the control file (file1)

Code:
read one record from file 2
read one record from file 1
build key1 and key2 for the first range
if at end of file fill key1 with an high value

do until endoffile(file2)

    if  recd >= key1 & recd <= key2 
        /* match - within range */
        process the record for match
        read one record from file2
        iterate/continue the do
    end if
    if  recd < key1 
        /* not match , below range  */
        process the record for not match
        read one record from file2
        iterate/continue the do
    end if
    if  recd > key2 
        /* not match , above range */
        read another record from file 1
        build key1 and key2 for the next range
        if at end of file fill key1 with an high value
        iterate/continue the do
    end if
end

do end of file processing and cleanup
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Mon Feb 07, 2011 9:57 pm
Reply with quote

icon_rolleyes.gif
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Feb 07, 2011 10:07 pm
Reply with quote

Vasanth,

Please help me as I do not speak smiley face very well.

What does the eye rolling face mean?

Is this a positive contribution to the thread?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Mon Feb 07, 2011 10:10 pm
Reply with quote

vasanthkumarhb wrote:
icon_rolleyes.gif


maybe he cannot follow/understand a simple pseudocode,
it would be worth to meditate a career shift icon_evil.gif

he made another post with the rolling eyes and somebody ( not me ) deleted it
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Feb 07, 2011 10:44 pm
Reply with quote

Quote:
he made another post with the rolling eyes and somebody ( not me ) deleted it
I believe that might have been me. . .

IIRC - It added nothing to the topic and i couldn't understand why it was even posted. . .

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

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Feb 07, 2011 10:47 pm
Reply with quote

Maybe a written explaination is in order... Vansanth, anything to say?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Mon Feb 07, 2011 10:59 pm
Reply with quote

Thanks for your comments Enrico.


Quote:
it would be worth to meditate a career shift
he made another post with the rolling eyes and somebody ( not me ) deleted it


You would have made it still more simpler which i felt. What ever you want you are speaking here???? Crazy....!!

Quote:
Is this a positive contribution to the thread?


Yes
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Mon Feb 07, 2011 11:17 pm
Reply with quote

Quote:
You would have made it still more simpler which i felt. What ever you want you are speaking here???? Crazy....!!


ok for the language barrier, but could You please translate
and clarify Your comment?

was my pseudocode not clear, wrong, what ... ?
I see there are a few typos, hope You will forgive me!

anyway looks that we are all wasting time here
the TS just disappeared


Quote:
IIRC - It added nothing to the topic and i couldn't understand why it was even posted. . .
to p*** off people willing to help icon_biggrin.gif

edited to add a further comment, not to change history
the TS in the original post asked
Quote:
Please help me to build above logic with with sample code or some way.

I replied with the logic, up to him the code...
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Feb 08, 2011 10:25 am
Reply with quote

I find this forum very very interesting, especially when I see you guys disputing... icon_biggrin.gif

hello, enrico, when did you change your image? I hardly cannot recognize you... icon_arrow.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Feb 08, 2011 2:23 pm
Reply with quote

well.... we are not disputing ( me at least )
we are just trying to get a non stupid reason for the post with the rolling eyes
and to understand why it is topic related icon_biggrin.gif
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Feb 08, 2011 2:53 pm
Reply with quote

Personally I can see absolutely no value in that post, nor in the attempt to validate it.

If you can not contribute constructively then why bother.

You have been warned
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Feb 08, 2011 3:03 pm
Reply with quote

Hi Enrico !

>> we are just trying to get a non stupid reason for the post with the rolling eyes

Do you really believe, you will get a truthful reason? I think it's just a waste of time. Would be nothing else than fucking nonsens.

For my own, i find it interesting, that this is a subject, that is discussed by a few high experienced IT-specialists. The so called creme de la creme of the 21st century.

And for me, working as an well payed consultant, it' its a diverting dissipation. And a chance to proclaim my utter bollocks to this discussion here and getting money for it.

Please don't get me wrong. Don't consider this as an affront. I have the deepest respect for persons who bother oneself about something.

But sometimes it's not worth to do this. :-)

Btw, your pseudo-code was well done, and that on a holy Sunday !!!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Feb 08, 2011 3:21 pm
Reply with quote

Believing there is no evil in the human being, i guess a wrong emoticon was entered.


And yes, im not myself today.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Feb 08, 2011 3:33 pm
Reply with quote

Goedemorgen Peter !

Youw geloof aan de mensheid behouden geloven dag.

Veel groeten, UmeySan
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Feb 08, 2011 3:36 pm
Reply with quote

Hi UmeySan!

Quote:
For my own, i find it interesting, that this is a subject, that is discussed by a few high experienced IT-specialists. The so called creme de la creme of the 21st century.
...
Please don't get me wrong. Don't consider this as an affront. I have the deepest respect for persons who bother oneself about something.


No offence at all!

it is really very difficult even for experienced people
to choose the posts to reply and how to reply...
post like this one and like for example
ibmmainframes.com/viewtopic.php?t=53336&highlight=
should not have place in a professional forum but...

in this case I was pitying a pour soul and tried to help!

but nobody is ever happy around here

You are rude,
You replied/did not reply to a silly question,
You did not reply/replied to an intelligent question
I feel insulted,
my feet hurt,
my only neuron is tired,
my two only neurons went in a spin loop
You did not explain,
You did not give me the answer I expected
...
it' s urgent
I asked here because my support does not support me (*)

add as many idiotic complaints and whinings as You like

I just lurk and reply while doing something more interesting (*)
and I like ( since I can afford it ) to use sarcasm and unusual words
and even providing useful infos and replies

have a good day UmeySan icon_biggrin.gif
cheers
enrico

(*) for some people the best support would be certainly a rope around the neck icon_biggrin.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Feb 08, 2011 3:37 pm
Reply with quote

Dank jewel UmeySan
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Feb 08, 2011 4:35 pm
Reply with quote

Enrico,

Your last comment about support icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Feb 08, 2011 4:43 pm
Reply with quote

that' s what I would call dark/gothic sarcasm
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Tue Feb 08, 2011 6:59 pm
Reply with quote

Hi,

Can anyone of above help me to understand the logic little more clear as I am still confused?

I have 2 files

1st file just have account range (1000 9999 etc..)
2nd file with data

if anyof the account in the data file match with the account in the account range then perform some thing etc.

just need help on iteration perform part.

Please help.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Feb 08, 2011 7:02 pm
Reply with quote

what did You not understand in the pseudo code I posted ?
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Tue Feb 08, 2011 7:35 pm
Reply with quote

Layout of both files are as follows

Code:
Accnt range file :
01  ACCT-RANG-REC.
           05  FROM-ACCT-NO.
               10  ACRG-FROM-OFFC      PIC  X(03).
               10  ACRG-FROM-ACCT      PIC  X(05).
           05  THRU-ACCT-NO.
               10  ACRG-THRU-OFFC      PIC  X(03).
               10  ACRG-THRU-ACCT      PIC  X(05).
           05  ACRG-FILLER             PIC  X(64).

Data file Key part

01  DATALINE-REC.
           05  ML-KEY.
               10  ML-CLIENT           PIC XX.
               10  ML-OFFC-ACCT.
                   15  ML-OFFICE       PIC XXX.
                   15  ML-ACCOUNT      PIC X(5).
               10  ML-CURRENCY-CODE    PIC XX.






Till now i have done as follows

Code:
Perform READ-ACCT-RANGES

READ ACNT-RANGE-FILE                         
    END                                     
        MOVE HIGH-VALUES TO FROM-ACCT-NO
     NOT END                                 
        ADD  1           TO AR-CTR           
END-READ.                                   

PERFORM I-MAIN-LOGIC      THRU PARA-EXIT
    UNTIL FROM-ACCT-NO = HIGH-VALUES.   

MOVE FROM-ACCT-NO TO ML-OFFC-ACCT.

START MONY-LINE-FILE KEY >= ML-KEY.         
EVALUATE ML-STATUS                           
    WHEN '00'                               
        PERFORM 175-READ-DATALINE-FILE     
    WHEN '23'                               
        MOVE HIGH-VALUES TO ML-OFFC-ACCT     
    WHEN OTHER                               
        DISPLAY 'ABORT NUMBER:  ' ABEND-NUM 
        DISPLAY 'FILE STATUS :  ' ML-STATUS 
        PERFORM 999-ABORT-JOB               
END-EVALUATE.                               

175-READ-DATALINE-FILE.                       
    READ DATA-LINE-FILE NEXT.                   
    EVALUATE ML-STATUS                         
        WHEN '00'                               
            ADD  1           TO ML-CTR         
        WHEN '10'                               
            MOVE HIGH-VALUES TO ML-OFFC-ACCT   
        WHEN OTHER                             
            DISPLAY 'ABORT NUMBER:  ' ABEND-NUM
            DISPLAY 'FILE STATUS :  ' ML-STATUS
            PERFORM 999-ABORT-JOB               
    END-EVALUATE.                               

PERFORM UNTIL ML-OFFC-ACCT > THRU-ACCT-NO
perform...
peform ... etc
etc..

PERFORM 175-READ-DATALINE-FILE
Perform READ-ACCT-RANGES



Could you suggest more efficient and simple way of achieving above?


Regards,
N
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Feb 08, 2011 7:43 pm
Reply with quote

yeah, use the rope that enrico mentioned earlier.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Feb 08, 2011 7:49 pm
Reply with quote

Quote:
Could you suggest more efficient and simple way of achieving above?
It is not always possible to do this. Some problems just require a certain amount of logic (and hence code) to resolve -- and without completely changing the problem statement, you cannot get around this. Either learn to deal with the complexity, or get used to being utterly confused as an IT person, or find a career that doesn't require the complexity. Your choice.
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Tue Feb 08, 2011 7:49 pm
Reply with quote

Anyway.. can you please give me some examples of such programs so that i will take a look and try to buid it accordingly.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts purge jobs with return code 0 and ret... JCL & VSAM 4
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Using API Gateway from CICS program CICS 0
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top