Thanks for the hint. I’ll read the documentation…

At the moment I think there’s no way to distinguish between alpha, numerics and logicals automatically. So I have to use different copycodes for differnent formats…

BTW. For numeric, packed, integer and float fields, I use the following techique. I do this because it’s would be very time consuming to find out the field format of ddm-fields (since the format is not visible inside the program).

```
*
include hexdmpNc '#i4-field' '"#i4-field"'
include hexdmpNc '#n2-field' '"#n2-field"'
*
```

```
*
* Dump-Copycode for types F, I, N and P
*
/* to be sure that copycode is only used for F, I, N, P
if &1& = 0 ignore end-if /* would work for B, D, T also
move edited &1& (EM=Z) to +dump-iw-a /* would work for L also
*
compress numeric full &1& into #a
move edited &1& (EM=H(30)) to #a2
/* determine format of field
callnat 'hexdmpnn' #a #a2 #a2
compress &2& '(' #a2 ')' into #a2 leaving no
if *LENGTH(#a2) < 32
compress full #a2 ' ' into #a2
reduce dynamic #a2 to 32
end-if
compress numeric &1& into #a
write work file 30 variable #a2 ' = ' #a H'0A'
move edited &1& (EM=H(30)) to #a
write work file 30 variable #a2 ' = H''' #a '''' H'0A'
```

And here’s HEXDMPNN

```
*
* determine field type/length for numeric/packed/integers/floats
*
define data parameter
1 #input-parameter
2 numeric-full (A) DYNAMIC BY VALUE
2 hexdump (A) DYNAMIC BY VALUE
1 #output-parameter
2 format-length (A) DYNAMIC BY VALUE RESULT
local
1 #a (a) DYNAMIC
1 #i4 (I4)
1 #format (A1)
1 #int (I1)
1 #frac (I1)
end-define
*
reduce dynamic #output-parameter.format-length to 0
*
* Check for float
*
if #input-parameter.numeric-full = scan ('E')
decide on first value of *LENGTH(#input-parameter.numeric-full)
value 22
#output-parameter.format-length := "F8"
value 13
#output-parameter.format-length := "F4"
none value
#output-parameter.format-length := "X"
end-decide
escape module
end-if
*
* Check for Integer
*
#a := #input-parameter.numeric-full
examine #a for '-' delete
if *LENGTH(#input-parameter.hexdump) = 8 and *LENGTH(#a) = 10
#output-parameter.format-length := "I4"
escape module
end-if
if *LENGTH(#input-parameter.hexdump) = 4 and *LENGTH(#a) = 5
#output-parameter.format-length := "I2"
escape module
end-if
if *LENGTH(#input-parameter.hexdump) = 2 and *LENGTH(#a) = 3
#output-parameter.format-length := "I1"
escape module
end-if
*
* Check for decimal point
#int := *LENGTH(#a)
#frac := 0
for #i4 := 1 to *LENGTH(#a)
if substr(#a,#i4,1) = "0" or="1" or="2" or="3" or="4" or="5" or="6" or="7" or="8" or="9"
ignore
else
#int := #i4 - 1
#frac := *LENGTH(#a) - #i4
escape bottom
end-if
end-for
if *LENGTH(#input-parameter.hexdump) = 2 and #int = 1
if substr(#input-parameter.hexdump,2,1) = substr(#a,1,1)
#format := 'N'
else
if substr(#input-parameter.hexdump,1,1) = substr(#a,1,1)
#format := 'P'
else
#output-parameter.format-length := 'X'
escape module
end-if
end-if
end-if
if (#int + #frac) * 2 = *LENGTH(#input-parameter.hexdump)
compress numeric 'N' #int into #output-parameter.format-length leaving no
else
compress numeric 'P' #int into #output-parameter.format-length leaving no
end-if
if #frac ne 0
compress numeric #output-parameter.format-length "." #frac
into #output-parameter.format-length leaving no
escape module
end-if
*
end
```