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...


How to delete leading spaces/blank in COBOL ?
Example:- 01 data-name-1 pic x(220) " English is a
language".
I would like to delete leading spaces.

Answers were Sorted based on User's Feedback



How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / varun v

Yes, we can use "Inspect Tallying" for the same.

Wroking storage Variable:
01 WS-VAR PIC X(15) VALUE ' COBOL'.
01 WS-VAR-FINAL PIC X(15).
01 WS-TALLY1 PIC 9(02) VALUE ZERO.

Procedure Dvision:
Inspect WS-VAR Tallying WS-TALLY1 for leading spaces
Move WS-VAR(WS-TALLY1+1 : 15-WS-TALLY1) to
WS-VAR-FINAL.

Now WS-INSPECT-FINAL should have
Value 'COBOL'.

Is This Answer Correct ?    50 Yes 12 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / xyz

USe the Inspect Clause , get the number of the leading
spaces in the Count variable. Use the reference move then.

Is This Answer Correct ?    32 Yes 5 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / naveen

You have many options.

1. Use Reference modification if you want a COBOL program.
2. INSPECT will also do.
3. Use SORT, OUTREC option, it will also work.

Is This Answer Correct ?    8 Yes 1 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / varun v

I agree with Ans # 1 also.

But I think "Inspect Tallying" is the effective one as
there is no manual calculation is required for finding the
exact length of the second variable field(CHR6 in Ans #1)
is required.

Is This Answer Correct ?    7 Yes 3 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / arne royce tiangson

I CAN FIND THE WRITE OUTPUT.. PLEASE EXPLAIN THIS CODE
'MOVE WS-USERID-TEMP(WS-TALLY + 1 : ) TO WS-LS-USERID'

THNX

Is This Answer Correct ?    1 Yes 2 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / prasanth

Wroking storage Variable:
01 WS-VAR PIC X(15) VALUE ' COBOL'.
01 WS-VAR-FINAL PIC X(15).
01 WS-TALLY1 PIC 9(02) VALUE ZERO.

Procedure division


INITIALIZE WS-TALLY

MOVE ID-TBL-IMMS OF TBL TO WS-USERID-TEMP

INSPECT WS-USERID-TEMP TALLYING WS-TALLY
FOR LEADING SPACE

MOVE WS-TALLY TO WS-TEMP
IF WS-TALLY IS NOT ZERO

MOVE WS-USERID-TEMP(WS-TALLY + 1 : ) TO WS-LS-USERID

Is This Answer Correct ?    6 Yes 10 No

How to delete leading spaces/blank in COBOL ? Example:- 01 data-name-1 pic x(220) " English ..

Answer / minarul

you can do this by defining another varible with JUSTIFIED
RIGHT clause. then move the value from data-name-1 to that
varible. You have to define the picture clause of that
varible with proper length : below code will exactly do
that:

01 data-name-1 pic x(220) " English is a language".
01 CHR6 PIC X(217) JUSTIFIED RIGHT.
now do a move from data-name-1 to CHR6 and then disolay
the content of CHR6

Is This Answer Correct ?    20 Yes 33 No

Post New Answer

More COBOL Interview Questions

why 02 level number can't be use as a separate level number like 01 or 77 ?

3 Answers  


how to access the file from prodution from changeman tool and to submit a file to production

1 Answers   IBM,


We have 3 programms A,B,C.In the middle of the program A the controls goes to program B and in the middle of the program B control wants to go program C,after completion of program C again control comes to program B and again after completion of program B control comes to program A.How the process will takes and what are the controls we use for that process.If it is possible anybody of you explain with example?

5 Answers   IBM,


what is the difference between COBOL2 AND COBOL390?

0 Answers   L&T,


Have you code any new programs in COBOL ? What is the functionality of the programs?

2 Answers   Patni, Xansa,


When would you use in-line perform?

2 Answers  


hi friends,can any one post the ibm mainframe inteqview questions for 1year exp candidate,for itc infotech interview?. have any body attended for this in the past?...

1 Answers   ITC Infotech,


What is the difference between SEARCH and SEARCH ALL? What is more efficient?

9 Answers   IBM, iFlex, Wipro,


What is the meaning of 'Eject' verb in cobol?

2 Answers   TCS, Wipro,


What is diff betn PS and ESDS file? What is the diffrent compiler options in cobol and there discription? What is retrive nth maximum salary from salary DB2 table. Can we redefine COM-3 variable with varchar variable?

4 Answers  


which certifications r 4 cobol,jcl,db2,cics what is format of xam n what is importance of these certifications... plz post answer only if u r sure... thanks

1 Answers  


how the control comes back from subprogram to mainprogram

3 Answers   IBM,


Categories