# How to move P to N field?

**URL:** <https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Natural, Adabas-on-Mainframes, Natural-on-Mainframes, NaturalONE\
**Created:** [April 24, 2024, 3:35pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087 "2024-04-24T15:35:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imnacho2000](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/imnacho2000/32/31777_2.png) [@Imnacho2000](https://techcommunity.softwareag.com/u/Imnacho2000)\
**Post date:** [April 24, 2024, 3:35pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/1 "2024-04-24T15:35:18Z")

</div>

#### **How i said in the title** i have a **P** field and i need move to _ **N** field, how to do that? because a simple **MOVE** _ i can’t do

#### _For example:_

#### DEFINE DATA

Local  
1 VAR-P (P09)  
1 RESULT-N (N11) (EM=ZZZ.ZZZ.ZZ9)  
END-DEFINE  
WRITE ‘=’ VAR-P  
MOVE VAR-P TO RESULT-N  
END

OUTPUT  
VAR-P = 440?000

#### _Error messages:_ NAT0954 Abnormal termination S0C7 during program execution.

#### _ACLARATION: i’m new in this, sorry for the ignorance, any help it’s welcome here!, thanks for reading and for u time_

---

<div class="post-metadata">

**Author:** ![wolfgang.winter](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/wolfgang.winter/32/17954_2.png) [@wolfgang.winter](https://techcommunity.softwareag.com/u/wolfgang.winter)\
**Post date:** [April 24, 2024, 3:50pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/2 "2024-04-24T15:50:08Z")

</div>

A S0C7 indicates invalid data in the packed field, how did this value into the field ?

Move valid data into VAR-P and it’ll work, MOVE from P to N is the correct way.

---

<div class="post-metadata">

**Author:** ![Imnacho2000](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/imnacho2000/32/31777_2.png) [@Imnacho2000](https://techcommunity.softwareag.com/u/Imnacho2000)\
**Post date:** [April 24, 2024, 3:51pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/3 "2024-04-24T15:51:35Z")

</div>

This value is coming from file

---

<div class="post-metadata">

**Author:** ![wolfgang.winter](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/wolfgang.winter/32/17954_2.png) [@wolfgang.winter](https://techcommunity.softwareag.com/u/wolfgang.winter)\
**Post date:** [April 24, 2024, 4:00pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/4 "2024-04-24T16:00:16Z")

</div>

Then the data coming from your file is NOT PACKED:

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [April 24, 2024, 4:04pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/5 "2024-04-24T16:04:47Z")

</div>

Or someone managed to store invalid data on the file. This can happen if the P field is redefined.

```auto
DEFINE DATA                      
LOCAL                            
1 VAR-P (P09)                    
1 REDEFINE VAR-P                 
  2 VAR-A (A05)                  
1 RESULT-N (N11) (EM=ZZZ,ZZZ,ZZ9)
END-DEFINE                       
MOVE 'ABCE' TO VAR-A             
MOVE VAR-P TO RESULT-N           
DISPLAY VAR-P RESULT-N           
END

```

This will result in SOC7.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [April 24, 2024, 4:57pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/6 "2024-04-24T16:57:58Z")

</div>

Some things to use when the incoming data is suspect:

- check if the field is packed with the “IF = MASK(NNNNNNNNZ)” statement and report an error if it is not (see docs: [Logical Condition Criteria](https://documentation.softwareag.com/natmf/9.2.2/en/webhelp/natmf-webhelp/pg/pg_furth_lcc.htm#numeric_data))
- display the field with a hex edit mask to see the actual contents of the field (EM=H(5)) in hex

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 24, 2024, 5:32pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/7 "2024-04-24T17:32:38Z")

</div>

By “file”, do you mean a flat file you are reading from a CMWKFnn dataset, or a database file? I suppose in either case it is possible your DEFINE DATA doesn’t accurately reflect the actual content (yes a view of an ADABAS file can be wrong and not match the FDT). The other replies are correct as to why the error occurs, though, but my suggestion is to investigate if the source data really contains the content (column width, format, length) that the program is expecting to read.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [October 21, 2024, 5:32pm UTC](https://techcommunity.softwareag.com/t/how-to-move-p-to-n-field/295087/8 "2024-10-21T17:32:48Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
