View previous topic :: View next topic
|
Author |
Message |
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
Hi,
I have two variables :
03 WS-APPID S9(4) COMP.
03 WS-JZ-APPID X(4).
Can i move WS-JZ-APPID to WS-APPID ??
If yes, Can I use WS-APPID further in my program. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
Hi Escapa,
Thanks for your reply.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Khushboo.goel, be aware that you are moving a 4-byte alphanumeric variable to a 2-byte numeric variable. The MOVE will happen, but the results might not be what you think they are, and using WS-APPID in your program certainly will not be using anything like WS-JZ-APPID. For example, if WS-JZ-APPID is 'ABCD', then WS-APPID will be 49602 (or 9602 depending upon your compiler options). |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
A bit lazy and incurious, eh?
Couldn't you just try and see what you get? You would need to view the results in hex of course.
Your way, if anyone asks you the same question, you'll say YES, and when they ask why it works, you can only answer: someone I don't know said so. That'll look good on your annual review. |
|
Back to top |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
Hi Robert,
Thanks for your reply.
The scenario is i have to move a 2 byte data (example 11) to WS-JZ-APPID where first two bytes will be 00..
i.e. the data in WS-JZ-APPID will be like 0012 (its x(4) )
I have to then move it WS-APPID S9(4) COMP
I have to use WS-APPID further in my program for computation.
How should I be doing this? should i use NUMVAL? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
As long as WS-IZ-APPID contains numeric digits, the MOVE will be okay. However, you had better verify that it contains nothing but numeric digits before you do the move, or you may get a S0C7 abend in your code. The NUMVAL function isn't really required, although it might not hurt to make clearer to whoever maintains this code in later years what is going on. |
|
Back to top |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
can i also do like this??
WS-TEMP PIC S9(4)
MOVE WS-JZ-APPID to WS-TEMP
MOVE WS-TEMP to WS-APPID
will this work? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Khushboo.goel wrote: |
can i also do like this??
WS-TEMP PIC S9(4)
MOVE WS-JZ-APPID to WS-TEMP
MOVE WS-TEMP to WS-APPID
will this work? |
WHY CAN'T YOU TRY... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Doing your own testing will provide you much better insight than me writing the test. |
|
Back to top |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
Sorry to nag.. but currently, i cant run the code and just have to complete the code :'(
So, i was asking for your opinion..
It would be great if anyone can help me out... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
i cant run the code and just have to complete the code :'( |
This makes absolutely no sense -- either you can compile and test the code, or you cannot. If you cannot compile and test the code why are you attempting to write it? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
If you cannot compile and test the code why are you attempting to write it? |
New maangement process Robert:
someone who can't code
instead does the pseudo code for the coder. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
dbzTHEdinosauer wrote: |
Quote: |
If you cannot compile and test the code why are you attempting to write it? |
New maangement process Robert:
someone who can't code
instead does the pseudo code for the coder. |
Everything old is new again; remember the programmer/coder distinction from the 1960s? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Everything old is new again; remember the programmer/coder distinction from the 1960s? |
And turning keypunch sheets over to the keypunch operator -- hoping your writing was clear enough! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
And turning keypunch sheets over to the keypunch operator - |
ah, those were the days.
quick 'card shuffle' of some asshole's just punched card-deck
was always refreshing.
I started in an NCR shop, the cobol did not have a SORT,
so you either manually resorted your card deck
or hoped no one was using the card-sorter.
which during the day was intentially busy to really 'teach' the assholes a lessen. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
yeah, yeah, yeah, i failed to mention that I often found my decks 'shuffled' |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Khushboo.goel wrote: |
can i also do like this??
WS-TEMP PIC S9(4)
MOVE WS-JZ-APPID to WS-TEMP
MOVE WS-TEMP to WS-APPID
will this work? |
Late to the party on this.
Is WS-JZ-APPID supposed to be always numeric?
If yes, test that it is NUMERIC, do something reasonable (find out what from the spec writer) if it isn't then you can proceed as you coded above.
Any problem, as an alternative, with making WS-JC-APPID PIC 9(4)? Then you can ditch the WS-TEMP.
Now, where are the crackers? A little something for a parched throat? Ah, yes, I see... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Robert Sample wrote: |
And turning keypunch sheets over to the keypunch operator -- hoping your writing was clear enough! |
We finished our Cobol/JCL (DOS) training. We didn't know how to use a terminal (and they were shared, as well). So our "end of course" program was to be written on coding sheets, and off to "data-entry". My "program" came back with every 2 a Z and every Z a 2. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I often found my decks 'shuffled' |
Which was the reason for the diagonal stripe on the top of the card deck. . . At my first place, this was also know as floor-sorting ('cause sometimes an entire tray or 2 of cards got tipped over)
Quote: |
We didn't know how to use a terminal (and they were shared, as well). |
Terminal - we didn' have no steenkin terminal.
Quote: |
My "program" came back with every 2 a Z and every Z a 2. |
Remember the black/red automatic pencils (black on one end, red on the other)? Not only did things get mis-keyed, but it took much longer to write carefully than if one keyed their own . . .
Those were the days. . . Maybe not |
|
Back to top |
|
|
|