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 a var from nth pos in a file to 1st position of another

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

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 5:50 pm    Post subject: Move a var from nth pos in a file to 1st position of another
Reply with quote

Code:

IF INPUT-CHAR-1 (WS-IND1) = '****'
    MOVE INPUT-CHAR-1(WS-IND1) TO INPUT-CHAR-2 (WS-IND2)



But the first file is of a variable length while the file the INPUT-CHAR-2 will be written is of FB 25, so i want the code to move INPUT-CHAR-1(WS-IND1) TO INPUT-CHAR-2(0), i.e, the first position in 2nd file. How do i do that ?

As for the existing code it throws the error

Code:

NOT ENOUGH SUBSCRIPTS OR INDICES WERE SPECIFIED FOR  INPUT-CHAR-2


what do i need to change???
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 24, 2009 6:02 pm    Post subject:
Reply with quote

1. subscript and index values of 0 are a no-no. the first occurance is 1.

2. what are the data descriptions of these fields?

3. we don't know if these are indexes or sub-scripts (ws-ind1, ws-ind2).

4. what is the definition of INPUT-CHAR-1 ? is it 3 char in length?
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 6:32 pm    Post subject: Reply to: Move a var from nth pos in a file to 1st position
Reply with quote

@dbz

sorry about that , i meant at the 1st occurence.

Currently its like this

Code:

INPUT-CHAR-1 OCCURS 25 TIMES INDEXED BY
    WS-IND1 PIC 99. 
INPUT-CHAR-2 OCCURS 25 TIMES INDEXED BY
    WS-IND2 PIC 99. 

       


and INPUT-CHAR-1 is pic X(01)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 24, 2009 6:45 pm    Post subject:
Reply with quote

Quote:

and INPUT-CHAR-1 is pic X(01)



no it is not,
it is PIC 99 just like INPUT-CHAR-2.
Quote:

INPUT-CHAR-1 OCCURS 25 TIMES INDEXED BY
WS-IND1 PIC 99.



and we need the level numbers of the INPUT-CHAR-1/2 data definitions so that we can determine the cause of
Quote:
NOT ENOUGH SUBSCRIPTS OR INDICES WERE SPECIFIED FOR INPUT-CHAR-2
Back to top
View user's profile Send private message
Sudhanshu Shekhar

New User


Joined: 23 Jul 2008
Posts: 27
Location: City of Joy

PostPosted: Tue Feb 24, 2009 7:07 pm    Post subject: Reply to: Move a var from nth pos in a file to 1st position
Reply with quote

Hey thanks dbz

Your last input was very helpful ....

INPUT-CHAR1 was a table array DOUBLE OCCURS CLAUSE VARIABLE (LEVEL 15), WHILE I HAD DEFINED THE INPUT-CHAR2 WITH SINGLE OCCURS CLAUSE (LEVEL 10).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 24, 2009 7:11 pm    Post subject:
Reply with quote

glad you were able to determine the problem and work on a solution.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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