Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I've one string with spaces ( I N D I A ). My question is I
want remove the spaces & combine in to single string without
space (INDIA).How we can write the cobol program & wich
options we need to use. Please let me know.

Answers were Sorted based on User's Feedback



I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / jagan

Inspect string1 replacing all spaces by ''

Is This Answer Correct ?    13 Yes 2 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / mayank rastogi

Use following code: It'll work

MOVE 'I N D I A' TO WS-NAME.

UNSTRING WS-NAME DELIMITED BY ' '
INTO WS-CHAR1, WS-CHAR2, WS-CHAR3, WS-CHAR4, WS-CHAR5.
STRING WS-CHAR1, WS-CHAR2, WS-CHAR3, WS-CHAR4, WS-CHAR5
DELIMITED BY SIZE INTO WS-NAME1.

ws-name1 is the new variable that will contain INDIA
without any spaces

Is This Answer Correct ?    11 Yes 1 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / uday

Through reference modification we can acheive and it is the
best way.

In Working storage section

01 ws-india pic x(10) value ' I N D I A '
01 ws-india-f pic x(05).


In procedure division

Perform varying ws-i from 1 by 1 until wi-i > 20

If ws-india(ws-i:1) = spaces
continue
Else
move ws-india(ws-i:1)to ws-india-f
End-if

End-perform

Is This Answer Correct ?    3 Yes 0 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / wairagade

Can we do with referrence modication operator .. your
thoughts :)

Is This Answer Correct ?    2 Yes 0 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / jagan

Yes we can do it with reference modification too . But feel
the code will become a bit complex.

Is This Answer Correct ?    1 Yes 0 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / arpan

Probably you can write SPACES instead of ' ' in the
UNSTRING statement.

UNSTRING WS-NAME DELIMITED BY SPACES
INTO WS-CHAR1, WS-CHAR2, WS-CHAR3, WS-CHAR4, WS-CHAR5.
STRING WS-CHAR1, WS-CHAR2, WS-CHAR3, WS-CHAR4, WS-CHAR5
DELIMITED BY SIZE INTO WS-NAME1.

Is This Answer Correct ?    2 Yes 1 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / jagan

Thanks Mayank .... My answer was not correct. The code what
you mentioned is working properly .. But what in case we
don't know how many spaces (or) delimiters are there in the
string.....

Is This Answer Correct ?    0 Yes 0 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / sup

small modification to ans 9th,

If ws-india(ws-i:1) = spaces
continue
Else
move ws-india(ws-i:1)to ws-india-f(i:1)
i=i+1
End-if

Is This Answer Correct ?    3 Yes 3 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / karthik

STRING WS-NAME DELIMETED BY SPACES
INTO
OUT-VAB

Is This Answer Correct ?    0 Yes 6 No

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & comb..

Answer / ashwani

With the help of Unstring delimited by ' ' , you can do so

Please correct me if i am wrong............

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More COBOL Interview Questions

What is the difference between PIC 9.99 and 9v99 in COBOL?

0 Answers   SwanSoft Technologies,


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

0 Answers  


HOw can I get the negative sign while deduct high value from low value

0 Answers  


Suppose i want to declare a binary comp fild of 7 byte .how to write?

6 Answers   IBM,


how to display comp3 variables reply soon ?

4 Answers   Patni,


ID DIVISION. PROGRAM-ID. PLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR1 PIC 9(2). 01 VAR2 PIC X(2). PROCEDURE DIVISION. ACCEPT VAR2. MOVE VAR2 TO VAR1. STOP RUN. if i give 'PI' in var2 then what will b output of progr. any abend?????

6 Answers   TCS,


What are the different forms of EVALUATE statement?

2 Answers   IBM, Micro Labs,


tell me about examine inspect and evaluate ?

2 Answers   CTS,


Explain Restart Logic in Cobol?

1 Answers   L&T, Syntel,


Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc

0 Answers  


How to print 10 to 1 if the input have only 10 digit number?

0 Answers  


How do you submit JCL via a Cobol program?

5 Answers   IBM,


Categories