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

Redefines in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:19 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:26 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:30 pm
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:31 pm
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: 275
Location: Bang,iflex

PostPosted: Thu Nov 15, 2007 2:36 pm
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
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 2:44 pm
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
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
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Nov 15, 2007 3:04 pm
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top