COBOL MOVE CORRESPONDING DOUBT
Moderators: dbzTHEdinosauer, Moderator Group
COBOL MOVE CORRESPONDING DOUBT
Hi,
Wishes !
I have a tiny doubt in COBOL "MOVE CORRESPONDING" working. Please find below my scenario,
Layout#1:
01 WS-LAYOUT-1
05 WS-MOVE-1
10 WS-FIELD-1 PIC X(02).
10 WS-FIELD-2 PIC S9(09) COMP-3.
Layout#2:
01 WS-LAYOUT-2
05 WS-MOVE-2
10 WS-FIELD-1 PIC X(02).
10 WS-FIELD-2 PIC 9(07).
With this layouts,when I execute the below statement,
MOVE CORRESPONDING WS-MOVE-1 TO WS-MOVE-2
Whether WS-FIELD-2 from input layout will get moved to output layout or not?
Thanks in advance !
Thanks,
Perumal.N.K.
Wishes !
I have a tiny doubt in COBOL "MOVE CORRESPONDING" working. Please find below my scenario,
Layout#1:
01 WS-LAYOUT-1
05 WS-MOVE-1
10 WS-FIELD-1 PIC X(02).
10 WS-FIELD-2 PIC S9(09) COMP-3.
Layout#2:
01 WS-LAYOUT-2
05 WS-MOVE-2
10 WS-FIELD-1 PIC X(02).
10 WS-FIELD-2 PIC 9(07).
With this layouts,when I execute the below statement,
MOVE CORRESPONDING WS-MOVE-1 TO WS-MOVE-2
Whether WS-FIELD-2 from input layout will get moved to output layout or not?
Thanks in advance !
Thanks,
Perumal.N.K.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
funny, nearly all your posts sound the same.perumalnk wrote:I have a tiny doubt...
you are just to lazy to read the manual.
explanation which will remove all doubts
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
Hi All,
Thanks for the reply.
I did try that out. It got moved , but initially I thought it will not get moved as the declarations differ. So just to confirm my understanding, I asked this doubt. Sorry that it bothered much.
The WS-FIELD-2 of input layout comes from an IMS DB.Now when I changed the output layout WS-FIELD-2 declaration to S9(9) comp-3, I faced S0C7 abend at the move. For the same segment values when I declare my output WS-FIELD-2 as 9(8),job goes through fine !
Thanks,
Perumal.N.K.
Thanks for the reply.
I did try that out. It got moved , but initially I thought it will not get moved as the declarations differ. So just to confirm my understanding, I asked this doubt. Sorry that it bothered much.
The WS-FIELD-2 of input layout comes from an IMS DB.Now when I changed the output layout WS-FIELD-2 declaration to S9(9) comp-3, I faced S0C7 abend at the move. For the same segment values when I declare my output WS-FIELD-2 as 9(8),job goes through fine !
Thanks,
Perumal.N.K.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
**sigh** the SOC7 indicates that you have non-numerics in a numeric field.I faced S0C7 abend at the move
all you have managed to do is just propogate the garbage thru your program,
instead of taking an exception routine,
denoting the problem - and the values,
substituting appropriate default values or
doing something to tell someone that their is garbage in the system.
do you work for the government?
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Hi Dick Brenholtz,
Those are new fields added in a segment and they might be hoding low values for the existing entries in the DB. I understand that is the reason for S0C7. I just wonder why is the data exception abend is not occuring when I use 9(8)? I expect the S0C7 abend when use the same data with the declaration of 9(8). Hope my doubt is clear to you now.
I dont work for govt.
Thanks,
Perumal.N.K.
Those are new fields added in a segment and they might be hoding low values for the existing entries in the DB. I understand that is the reason for S0C7. I just wonder why is the data exception abend is not occuring when I use 9(8)? I expect the S0C7 abend when use the same data with the declaration of 9(8). Hope my doubt is clear to you now.
I dont work for govt.
Thanks,
Perumal.N.K.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
PIC 9n display/PIC S9n display is for all-intents-and-purposes - alphanumeric,
which allows you to stuff any garbage into the field
with the added feature that you can perform arithmetic with the field.
IMUO:
move corr should not be used and most site standards don't allow it.
it only saves in the coding, as the generated code is still single moves.
i believe that you should always maintain numeric values in pure numeric fields (comp, comp-3)
which helps remove garbage from the data flow.
you could have tested for low-values and moved zero to a comp-3 field.
which allows you to stuff any garbage into the field
with the added feature that you can perform arithmetic with the field.
IMUO:
move corr should not be used and most site standards don't allow it.
it only saves in the coding, as the generated code is still single moves.
i believe that you should always maintain numeric values in pure numeric fields (comp, comp-3)
which helps remove garbage from the data flow.
you could have tested for low-values and moved zero to a comp-3 field.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Hi Dick Brenholtz,
Thanks for clarifying the reason behind the S0C7 when the variable is declared as PD. I was wondering the reason behind it.
Yeah, as MOVE CORRESPONDING was used already at that place, we did not get the drive to make an explicit check for low values.
Thanks again.
Thanks,
Perumal.N.K.
Thanks for clarifying the reason behind the S0C7 when the variable is declared as PD. I was wondering the reason behind it.
Yeah, as MOVE CORRESPONDING was used already at that place, we did not get the drive to make an explicit check for low values.
Thanks again.
Thanks,
Perumal.N.K.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page