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
 

 

Concatenate the variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Thu Jun 09, 2011 3:55 pm    Post subject: Concatenate the variable.
Reply with quote

Hi I have requirement like below, my variables are like below,

Code:
QTY01    PIC 9(2)   VALUE 20
QTY02    PIC 9(2)   VALUE 10
.
.
.
.
QTY20   PIC 9(2)   VALUE 10.


THESE VARIABLES ARE NOT AN OCCURS. I want to check these variables and if it is not spaces need to move to another variable.

Will it be possible to use this variable in loop to check the condition instead of checking each variable like below,

Code:
IF QTY01 NOT EQUAL SPACES
.
.
ELSE
   IF QTY02 NOT EQUAL SPACES
   .
   .
   ELSE
      IF QTY20 NOT EQUAL SPACES
      .
      .
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jun 09, 2011 4:12 pm    Post subject: Re: Concatenate the variable.
Reply with quote

Senthilkumar k wrote:

[...]

Code:
QTY01    PIC 9(2)   VALUE 20
QTY02    PIC 9(2)   VALUE 10
.
.
.
.
QTY20   PIC 9(2)   VALUE 10.


[...]


Definine/redefine it as a table, then you can do it in a loop.

You might want to look at your compile options if your code does not correctly identify the space.

Change the damn datanames. What the heck is QTY01? You seem to have 20 datanames just differing from each other by a sequential number. For the birds.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Jun 09, 2011 4:13 pm    Post subject:
Reply with quote

you are going to have syntax errors if you try to compare a numeric display variable to an alpha literal.
Back to top
View user's profile Send private message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Thu Jun 09, 2011 4:54 pm    Post subject:
Reply with quote

These variables are already defined in MAP so I can not change this. Sorry I wrongly mentioned sa SPACES it is NUMERIC or not.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jun 09, 2011 5:18 pm    Post subject:
Reply with quote

Why not redefine the map in your program?
Back to top
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 110
Location: Puerto Rico

PostPosted: Thu Jun 09, 2011 7:19 pm    Post subject:
Reply with quote

Good day to all!

I think I am missing something because the variables have values assigned to them so comparing for numeric will always give you a true condition.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jun 09, 2011 7:23 pm    Post subject:
Reply with quote

Jose: MAP implies CICS which means if the data field in the map was not updated by the terminal user, LOW-VALUES will be returned to the program with the RECEIVE MAP command. At least, that's how I've interpreted the data provided so far by the t/s.
Back to top
View user's profile Send private message
zuozheng zhu

New User


Joined: 11 Apr 2011
Posts: 1
Location: china

PostPosted: Mon Jun 13, 2011 1:04 pm    Post subject: Re: Concatenate the variable.
Reply with quote

HI, I think the following solution will help you.

Code:

01 WK-QTY.
  03 wk-QTY00.
    05 QTY01        PIC 9(2)   VALUE 20.
    05 QTY02        PIC 9(2)   VALUE 10.
    .
    .
    .
    .
    05 QTY20        PIC 9(2)   VALUE 10.
  03 WK-QTY00-ARR REDEFINES WK-QTY00.
    05 WK-QTY00-OCC PIC 9(2)
                    OCCURS 20 TIMES.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jun 13, 2011 5:23 pm    Post subject:
Reply with quote

I agree with zuozheng zhu.
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 Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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