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

COBOL Filler and Redefines


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

New User


Joined: 10 Jul 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 04, 2008 7:00 pm
Reply with quote

Do filler is used in redefine clause like follows???

05 filler pic x(10).
05 filler redefines filler.
10 filler pic x(9).
10 A pic x(1).

Like this??? could u please advise.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Nov 04, 2008 7:21 pm
Reply with quote

Nope!
You should have tested your code before asking such question on forum. It would have saved you some time.
Back to top
View user's profile Send private message
balasu

New User


Joined: 10 Jul 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 04, 2008 7:29 pm
Reply with quote

Hi I am asking this, because I am having query and I could not able to find any rule saying " redefines clause will not be used for filler" any where in the text book. and more than that I got a requirement like that, thats the reason i posted this query. If u have any thread let me know that also. ok fine leave it.

So, what is ur final answer...... U have answers or are u simply telling " u have to test it before u ask such a questions"

if the answer is 2nd one, then a warm good bye to you all guys......in this forum.

Many a Thanks for ur kind reply.
Thanks,
Bala
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 Nov 04, 2008 7:42 pm
Reply with quote

If you'd tested, you would find
Code:
            01  WS-JUNK.
                05  FILLER                  PIC X(10).
                05  FILLER                  REDEFINES FILLER.

IGYDS0093-S "FILLER" was found in the "REDEFINES" clause.  The clause was discarded.

                    10  FILLER              PIC X(9).
                    10  A                   PIC X(1).
Furthermore, the manual while not explicit is pretty clear in stating
Quote:
___ Format _____________________________________________________________
| |
| >>__level-number__ _____________ __REDEFINES__data-name-2___________>< |
| |_data-name-1_| |
| |_FILLER______| |
| |
|________________________________________________________________________|
The fact that FILLER is listed before the REDEFINES verb but not after should have told you the answer to your question.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Nov 04, 2008 8:15 pm
Reply with quote

Quote:
then a warm good bye to you all guys
icon_lol.gif
Quote:
more than that I got a requirement like that

May I ask more about the strange requirement? If you tell us that, we may be able to offer you better solutions.
Back to top
View user's profile Send private message
balasu

New User


Joined: 10 Jul 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 04, 2008 8:22 pm
Reply with quote

Hi I Included the same and found the same as what u had mentioned in ur post.
But my query is still continues as follows:

I got a requirement as follows:

I am having a copy book and the record detail of the copybook as follows:

01 INPUT-RECORD PIC X(450).
05 WS-FILE-VAR PIC X(430).
05 FILLER PIC X(20).

And, in the source program, instead of using this Copy book, they have hardcaded the record structre as follows:
01 INPUT-RECORD PIC X(450).
05 WS-FILE-VAR PIC X(430).
05 FILLER PIC X(19).
05 ws-file-var1 pic x.

I was suppose to modify this source code, to remove this hardcoded record by including the copybook. If I included this copy book then, the compiler will throw "variable WS-FILE-VAR1 not found". and also, I was advised that I should not modify the existing copy book. Please advise me on the solution.
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 Nov 04, 2008 8:37 pm
Reply with quote

After you put the COPY statement, add:
Code:
01 INPUT-RECORD-R REDEFINES INPUT-RECORD.
     05  FILLER          PIC X(449).
     05  WS-FILE-VAR1       PIC X.
I have verified this will compile and provide the correct offset for WS-FILE-VAR1.
Back to top
View user's profile Send private message
balasu

New User


Joined: 10 Jul 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 04, 2008 8:53 pm
Reply with quote

Robert,
The code is like this,
01 INPUT-RECORD PIC X(450).
COPY INC0001A
05 WS-FILE-VAR PIC X(430).
05 FILLER PIC X(19).
05 ws-file-var1 pic x.

and in the copy book "INC0001A"
I am having:
05 WS-FILE-VAR PIC X(430).
05 FILLER PIC X(20).

Please advise on this.
Thanks,
Bala.
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 Nov 04, 2008 9:02 pm
Reply with quote

Take the 05 levels out of the code -- all 3 of them. Add the 01 redefines. Your code then should look like:
Code:
01  INPUT-RECORD.
     COPY INC0001A
 
01  INPUT-RECORD-R REDEFINES INPUT-RECORD.
     05  FILLER           PIC X(449).
     05  WS-FILE-VAR1     PIC X.
And why do you have PIC X(450) on the group 01 level -- it shouldn't be there?
Back to top
View user's profile Send private message
balasu

New User


Joined: 10 Jul 2008
Posts: 23
Location: bangalore

PostPosted: Tue Nov 04, 2008 9:11 pm
Reply with quote

Robert I think its not worked out. Because the redefine clasue must not be used for records in 01 level right..
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 Nov 04, 2008 9:31 pm
Reply with quote

Have you tried it? My compiler shows:
Code:
000038                01  INPUT-RECORD.
000039                    COPY MF0032.
000040C                   05  WS-FILE-VAR             PIC X(430).
000041C                   05  FILLER                  PIC X(020).
000042
000043                01  IR-REDEF                    REDEFINES INPUT-RECORD.

000044                    05  FILLER                  PIC X(449).
000045                    05  WS-FILE-VAR-A           PIC X(001).
000046
000047                LINKAGE SECTION.
 5655-G53 IBM Enterprise COBOL for z/OS  3.4.1               MF0031    Date 1
as well as showing the MAP output
Code:
     38   1  INPUT-RECORD. . . . . . . . . . . . . . . . . BLW=00000  008               DS 0CL450       Group
     40     2  WS-FILE-VAR . . . . . . . . . . . . . . . . BLW=00000  008   0 000 000   DS 430C         Display
     41     2  FILLER. . . . . . . . . . . . . . . . . . . BLW=00000  1B6   0 000 000   DS 430C         Display
     43   1  IR-REDEF. . . . . . . . . . . . . . . . . . . BLW=00000  008               DS 0CL450       Group
     44     2  FILLER. . . . . . . . . . . . . . . . . . . BLW=00000  008   0 000 000   DS 449C         Display
     45     2  WS-FILE-VAR-A . . . . . . . . . . . . . . . BLW=00000  1C9   0 000 1C1   DS 1C           Display
Furthermore, there is nothing in the COBOL Language Reference that rules out REDEFINES of 01 level groups. In fact, using multiple 01 levels in the FD of a file implicitly redefines each 01 level -- and the manual states that this is the behavior.
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: Tue Nov 04, 2008 9:48 pm
Reply with quote

Hello,

When you have a question you should start a new topic for your question rather than post a reply to a topic that has been inactive for a long time. . .

In this forum, people are expected to test things or look up things before posting questions. When this has obviously not been done, people mention it to the poster.

Quote:
if the answer is 2nd one, then a warm good bye to you all guys......in this forum.
We have a forum for beginners/freshers that may be better suited to you.
www.ibmmainframeforum.com/


Quote:
Because the redefine clasue must not be used for records in 01 level right..
Where did this misconception originate? If you have reference material or someone who says this, it is time to find a different source for information.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Nov 05, 2008 4:12 pm
Reply with quote

Balasu,
May be you are trying to use redefine under FD entry.
In file section all the 01 level entries under a FD entry are implicitely redefined. If this is your case then below code should work for you-

Code:

FD  somefile
01  INPUT-RECORD.
     COPY INC0001A
01  INPUT-RECORD-R
     05  FILLER           PIC X(449).
     05  WS-FILE-VAR1     PIC X.
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 COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Compile Sp Cobol base COBOL Programming 1
No new posts SQLCODE=-311 in Cobol SP-DB2. COBOL Programming 2
Search our Forums:

Back to Top