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
 

 

Redefines in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 2:14 pm    Post subject: Redefines in cobol
Reply with quote

Hi,
Can anyone help me out for my below requirement.

Input Copy book Layout :

01 DCL-FPLC
05 FPLC-FRNCHS-CD
05 FPLC-PLN-CTRL-ID
05 FPLC-PLN-CD
05 FPLC-YR

I have to move the above values to the below record using redefines.
01 INP-PLNCD-FILE-REC

Please share your thoughts with me.

Thanks,
Dhrani N.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:19 pm    Post subject:
Reply with quote

dharani,

Your requirement is not clear at all. icon_cry.gif
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 2:22 pm    Post subject:
Reply with quote

I have defined in file section like below
FILE SECTION.

FD INP-PLNCD-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 INP-PLNCD-FILE-REC PIC X(182).

The layout of the input file is in copy book
01 DCL-FPLC
05 FPLC-FRNCHS-CD
05 FPLC-PLN-CTRL-ID
05 FPLC-PLN-CD
05 FPLC-YR


Now the values of 01 DCL-FPLC have to be moved 01 INP-PLNCD-FILE-REC
01 DCL-FPLC
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:26 pm    Post subject:
Reply with quote

dharani,

Do a direct move.
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 2:29 pm    Post subject:
Reply with quote

I should not do direct move. All the values have to be assigned using redefines.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:30 pm    Post subject:
Reply with quote

dharani,

Hit 'submit' button too early.

INP-PLNCD-FILE is an input file or output.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:31 pm    Post subject:
Reply with quote

Quote:
I should not do direct move. All the values have to be assigned using redefines.

Any reason for this.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


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

PostPosted: Thu Nov 15, 2007 2:36 pm    Post subject:
Reply with quote

Hi Nagraj,


Quote:
01 INP-PLNCD-FILE-REC PIC X(182).

The layout of the input file is in copy book
01 DCL-FPLC
05 FPLC-FRNCHS-CD
05 FPLC-PLN-CTRL-ID
05 FPLC-PLN-CD
05 FPLC-YR


Now the values of 01 DCL-FPLC have to be moved 01 INP-PLNCD-FILE-REC
01 DCL-FPLC


Your quetion is still not clear, still, if the input file record structure matches with the shown record structure(means picture class should be matched in both the structure) then you can go for corressponding move statement.

As Murali said, you can go for direct move also.
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 2:39 pm    Post subject:
Reply with quote

I should not do direct move. All the values have to be assigned using redefines.
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 2:43 pm    Post subject: Redefine
Reply with quote

Hi,

How can we Redefine 01 level variable in copy book.

That is,

COPY <copyname> redefine ???????
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:44 pm    Post subject:
Reply with quote

dharani,

Please note that we can't read your mind (as you cant read ours). After this many posts, you are yet to come with your actual requirement.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Nov 15, 2007 2:46 pm    Post subject:
Reply with quote

Quote:
I should not do direct move. All the values have to be assigned using redefines.


What is the point u r trying to convey??

Quote:
if the input file record structure matches with the shown record structure(means picture class should be matched in both the structure) then you can go for corressponding move statement.


isn't this ok??

or please give a detailed explanation on what u want and why u want it so??[/quote]
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Thu Nov 15, 2007 2:47 pm    Post subject:
Reply with quote

Hi Dhrani,

Quote:
FILE SECTION.

FD INP-PLNCD-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 INP-PLNCD-FILE-REC PIC X(182).

The layout of the input file is in copy book
01 DCL-FPLC
05 FPLC-FRNCHS-CD
05 FPLC-PLN-CTRL-ID
05 FPLC-PLN-CD
05 FPLC-YR



Quote:
Now the values of
01 DCL-FPLC have to be moved 01 INP-PLNCD-FILE-REC



You can't redefines a variable in FD SECTION

That is DCL-FPLC with INP-PLNCD-FILE-REC <in FD SECTION>

It will internally Redefines incase if you are using COPY BOOK
Code:
01 DCL-FPLC
    05 FPLC-FRNCHS-CD
    05 FPLC-PLN-CTRL-ID
    05 FPLC-PLN-CD
    05 FPLC-YR 


after 01 INP-PLNCD-FILE-REC PIC X(182).

If it in WORKING-STOARAGE SECTION, then you can do it

This topic is discussed many times in forum
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Nov 15, 2007 3:02 pm    Post subject:
Reply with quote

Let me know how we can redefine working storage section
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 3:04 pm    Post subject:
Reply with quote

Dharani,

Quote:
Let me know how we can redefine working storage section

RTMF.

Is this is a HOMEWORK?
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Thu Nov 15, 2007 3:25 pm    Post subject: Reply to: Redefines in cobol
Reply with quote

01 A PIC 9(20).
01 B REDEFINES A
05 C PIC 9(05).
05 D PIC 9(10).
05 E PIC 9(05).

I think this might help you icon_biggrin.gif
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Thu Nov 15, 2007 4:07 pm    Post subject:
Reply with quote

Hi nagaraj,

You can redefine in this way

Code:
01 WS-A              PIC X(80).
01 WS-B               REDEFINES WS-A  PIC 9(80).



You can get in every COBOL Book,

Try to read manul before posting
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Nov 15, 2007 6:59 pm    Post subject:
Reply with quote

revel wrote:
01 WS-B REDEFINES WS-A PIC 9(80).

You can get in every COBOL Book,

Try to read manul before posting


Good idea, the max size of a numeric item is 18 or 31 depending on your compiler options.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Nov 16, 2007 2:04 am    Post subject:
Reply with quote

Hi,

You said:
Quote:
I have defined in file section like below
FILE SECTION.

FD INP-PLNCD-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 INP-PLNCD-FILE-REC PIC X(182).

The layout of the input file is in copy book
01 DCL-FPLC
05 FPLC-FRNCHS-CD
05 FPLC-PLN-CTRL-ID
05 FPLC-PLN-CD
05 FPLC-YR


Now the values of 01 DCL-FPLC have to be moved 01 INP-PLNCD-FILE-REC
01 DCL-FPLC

If you code:
Quote:
FILE SECTION.

FD INP-PLNCD-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 INP-PLNCD-FILE-REC PIC X(182).
COPY your-copybk name

Beleive it or not, every read of the file will "move" the values of 01 DCL-FPLC to 01 INP-PLNCD-FILE-REC.
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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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