---
title: "COBOL String modification idea using pointer statement"
description: "The popular string modification ways described here with examples. You can use these into your COBOL project directly."
url: https://srinimf.com/2012/03/28/cobol-string-modification/
date: 2012-03-28
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2012/03/cobol-string.png?fit=509%2C339&ssl=1
categories: ["COBOL"]
tags: ["cobol", "STRINGS"]
type: post
lang: en
---

# COBOL String modification idea using pointer statement

I am coming back after a little hectic work. Just sitting relaxed and reading the book “[How the Rich think](http://www.richdad.com/resources/rich-dad-financial-education-blog)“. I just started writing my blog post, got an idea [to write](https://srinimf.com/2017/02/01/the-best-tricky-tip-stored-procedure-if-and-cobol-if/) strings.

The fact is in COBOL, strings is an important concept. You may use it in many places viz: during dynamic SQL queries, concatenating names, error handling etc.

Related[COBOL strings popular ideas to learn now (2 of 2)](https://srinimf.com/2015/07/27/mainframecobol-strings-inspectconcatenation-splitting-2-of-2/)

**Usage 1:**

```
01 Final_name            pic x(8)  value "testname".
String   "18"  Delimited by Size
    into   Final-name
End-String
```

In this case the initialized value will be modified . So the new name is “18stname”.

**Usage 2:**

```
String "My name is srinimf" Delimited by Size
      Into New-name
End-string
```

In this case, the complete string moved into a new variable

**Usage 3:**

```
01 City   pic   x(3)  value "New city"

String   City  Delimited by '  '
      Into New-city-name
End-string
```

In this case, only upto first space will be moved into new name.

**Usage 4:**

```
o1 ws-cnt    pic  99.
Move 1  to  ws-cnt.
String "My name is srinimf" Delimited by Size
      Into New-name
      with Pointer ws-cnt
End-String
```

In this case, the ws-cnt will have the number of chars (ws-cnt -1) that finally moved.

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2012%2F03%2F28%2Fcobol-string-modification%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2012%2F03%2Fcobol-string.png%3Ffit%3D509%252C339%26ssl%3D1&description=COBOL%20String%20modification%20idea%20using%20pointer%20statement)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2012/03/28/cobol-string-modification/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2012/03/28/cobol-string-modification/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2012/03/28/cobol-string-modification/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2012/03/28/cobol-string-modification/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20String%20modification%20idea%20using%20pointer%20statement&body=https%3A%2F%2Fsrinimf.com%2F2012%2F03%2F28%2Fcobol-string-modification%2F&share=email)
-

### Like this:

Like Loading…
