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

Help with a MOVE statement


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

New User


Joined: 03 Aug 2007
Posts: 19
Location: Naperville

PostPosted: Fri Apr 04, 2008 7:49 am
Reply with quote

Hi,

I am trying to generate a JCL thru a COBOL program and I am writing the following MOVE statement but it gives me a error. Because the PARM field has the value in quotes and the whole statement has to be within quotes too.

MOVE '//DEMAND EXEC FORCE,PARM='NODACHK''
TO TEST1-RECORD.

Please let me know how do i correct this.

Error Message-

1701 IKF1007I-W NODACHK NOT PRECEDED BY A SPACE. ASSUME SPACE.
1701 IKF1079I-C ALPHANUMERIC LIT HAS ZERO LENGTH. ASSUME ONE SPACE.
1701 IKF1007I-W NOT PRECEDED BY A SPACE. ASSUME SPACE.
1701 IKF3001I-E NODACHK NOT DEFINED.
1701 IKF4007I-C TO MISSING OR MISPLACED IN MOVE STATEMENT. ASSUMED IN REQUIRED POSITION
1701 IKF4052I-E ALPHANUMERIC LITERAL (AN) MAY NOT BE TARGET FIELD FOR ALPHANUMERIC LITERAL (AN) IN MOVE STATEMENT, AND IS DISCARDED.
1701 IKF4008I-W SUPERFLUOUS TO FOUND IN MOVE STATEMENT. IGNORED.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 04, 2008 8:04 am
Reply with quote

Hello Avinash Gupta and welcome to the forums,

Quote:
MOVE '//DEMAND EXEC FORCE,PARM='NODACHK''
TO TEST1-RECORD.
You have "unbalanced quotes".

Try this:
Code:

MOVE SPACES TO TEST1-RECORD.
STRING '//DEMAND EXEC FORCE,PARM='
       QUOTE
       NODACHK
       QUOTE  DELIMITED BY '\'
  INTO TEST1-RECORD.


I'm not connect, so i've not tested this.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Fri Apr 04, 2008 10:49 am
Reply with quote

MOVE " //DEMAND EXEC FORCE,PARM='NODACHK' '' TO TEST1-RECORD.
Back to top
View user's profile Send private message
avinashgup

New User


Joined: 03 Aug 2007
Posts: 19
Location: Naperville

PostPosted: Fri Apr 04, 2008 10:58 am
Reply with quote

Thanks folks! Both the solutions worked for me. I tried both and they worked.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Apr 04, 2008 6:08 pm
Reply with quote

Another common way to handle embedded single quotes is to enter them twice:

MOVE 'JOE''S BOOK' TO VAR.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Apr 04, 2008 6:27 pm
Reply with quote

Phrzby Phil wrote:
Another common way to handle embedded single quotes is to enter them twice:

MOVE 'JOE''S BOOK' TO VAR.


That's the simplest and most straight forward way, if you have ever been taught COBOL (or most any other programming language).
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Apr 04, 2008 6:30 pm
Reply with quote

That's what Avinash did, except he forgot to add the closing quote that pairs with '//DEMAND....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 04, 2008 7:14 pm
Reply with quote

Hello,

Yup, i almost went with the quotes and literal solution but wanted to offer a way to accomplish the task and also be able to use variables in the resulting strung value.

Quite often, jcl that i create on the fly has more than literals. . .

Hope it wasn't mis-leading. . .
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 - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts How to move DB2 Installation HLQ DB2 4
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
Search our Forums:

Back to Top