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
 

 

Move Spaces to Record (at 01 Level).

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

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Tue May 27, 2014 10:14 pm    Post subject: Move Spaces to Record (at 01 Level).
Reply with quote

Hi,

If we move spaces to record level variable (at 01 level). What will happen to numeric fields which are at the elementary levels. Also what will happen to Filler and Occurs Variables.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue May 27, 2014 10:24 pm    Post subject: Reply to: Move Spaces to Record (at 01 Level).
Reply with quote

If you move space to a group item, everything subordinate to it will be set to space.

What happens after that depends.

Do you have a specific problem?
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue May 27, 2014 10:30 pm    Post subject:
Reply with quote

Any numeric fields will be filled with spaces which on z/OS is X'40'. This will translate into a numeric value or will be invalid.

If you use the INITIALIZE statement then it will move a value of 0 into all numeric fields and spaces into alphanumeric. Any FILLER items are left unchanged.
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Wed May 28, 2014 8:47 am    Post subject: Re: Reply to: Move Spaces to Record (at 01 Level).
Reply with quote

Bill Woodger wrote:
If you move space to a group item, everything subordinate to it will be set to space.

What happens after that depends.

Do you have a specific problem?



Hi,

In one of the existing programs instead of initializing the Record level group item , spaces are moved to the group item.

As far I know, Group Level move always acts as alphanumeric move irrespective of the type of data moved.

so in this case, if we move spaces to group item, even numeric item will contain spaces.. so if it is used for computation then it will throw error.

So I believe it is always good practice to initialize group variables instead of moving spaces to it.

Thanks.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed May 28, 2014 9:18 pm    Post subject:
Reply with quote

Now you get the the person in your group that knows how INITIALIZE works! Look it up and study it. Pay close attention to what it does with FILLER items, and to what it does with REDFINES items, and how it treats different types of PICTURE clauses.

I would go so far as to make a small program and actually try it out.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed May 28, 2014 10:58 pm    Post subject: Reply to: Move Spaces to Record (at 01 Level).
Reply with quote

For me it is always good practice to set an initial value only when it is needed.

There is no point in:

Code:
MOVE ZERO TO A
MOVE 9312T-CANCELLATION-AMOUNT TO A


Equally no point in

Code:
INITIALIZE RECORD-CONTAINING-A
MOVE 9312T-CANCELLATION-AMOUNT TO A
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Thu May 29, 2014 1:07 am    Post subject:
Reply with quote

Agree with Bill. I see that type of coding more often than I care to. Also, if a record area needs to be repeatedly initialized, I will usually initialize it once at the beginning of the program, save it off, then move it back to accomplish the reinitializing with one group move.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu May 29, 2014 3:36 am    Post subject: Reply to: Move Spaces to Record (at 01 Level).
Reply with quote

Yes. Usually what is really needed to be set to initial values is tables of counts and amounts for "break" processing. And the efficient way to do that is as Terry has outlined.

Since you only set it up once, you can do all sorts of extra checking (number of entries, lengths of entries, etc) and do things like setting up USAGE INDEX fields to the maxima of tables, so that you can have efficient loop control. It doesn't matter how much you put in there, as it only happens once.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu May 29, 2014 7:46 pm    Post subject:
Reply with quote

That's what she said.
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Mon Jun 02, 2014 2:52 pm    Post subject:
Reply with quote

Thank you all.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jun 02, 2014 5:28 pm    Post subject: Reply to: Move Spaces to Record (at 01 Level).
Reply with quote

In my early days, I used to MOVE SPACE to a group item for a record being output, before filling in the indivdual details.

My reasoning way, if I get bad numeric data because I forgot to put something in a field, then the abend will spot it for me.

Turned out to be fairly useless, as it doesn't help with alpha-numeric fields, and it takes far more than just having space in a field to make an abend. So I check the compiler listing and ensure that I haven't missed any fields (easily done, even in those days).

What you have done with your INITIALIZE is made the content of a field valid, whereas before it was sufficiently invalid to cause a S0C7. No actual value has been MOVEd to that field, you need to find out why.

You have "fixed" the code by just setting the field to zero, You need to find out if that is the correct value, or whether there is some other problem you are now masking.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed Jun 04, 2014 5:54 pm    Post subject:
Reply with quote

"You need to find out if that is the correct value, or whether there is some other problem you are now masking."

But that wasn't in the contract!
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


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