# Display (1) function

**URL:** <https://techcommunity.softwareag.com/t/display-1-function/202882>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [February 20, 2019, 12:52pm UTC](https://techcommunity.softwareag.com/t/display-1-function/202882 "2019-02-20T12:52:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ah\_Nam](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Ah\_Nam](https://techcommunity.softwareag.com/u/Ah_Nam)\
**Post date:** [February 20, 2019, 12:52pm UTC](https://techcommunity.softwareag.com/t/display-1-function/202882/1 "2019-02-20T12:52:10Z")

</div>

I have a print file that is begin pollinated by

Display (1)  
‘field1’ #field1  
‘field2’ #field2

I need to display ‘Listing A:’ only once before the fields are display.  
I will be grateful if somebody could tel me if this will work

Display (1) ‘Listing A:’ /  
‘field1’ #field1  
‘field2’ #field2

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [February 20, 2019, 5:15pm UTC](https://techcommunity.softwareag.com/t/display-1-function/202882/2 "2019-02-20T17:15:44Z")

</div>

You already know that this doesn’t work, because when you tried it yourself,

```auto
DEFINE DATA LOCAL
1 #FLD1 (A5) INIT <'AbCdE'>
1 #FLD2 (N5.2) INIT <-12345.67>
END-DEFINE
DISPLAY 'Listing A' / 'Field 1' #FLD1
        'Field 2' #FLD2
END
```

you saw

```auto
Page 1 02/20/19 07:49:48
 
 Field 1 Field 2
--------- ----------
 
Listing A -12345.67
AbCdE
```

In the report above, lines 1 and 2 are the report title and lines 3, 4, and 5 are the report header. You can place additional lines between those two sections with AT TOP OF PAGE. So, there are three solutions.

Solution 1 - Report Title

```auto
DEFINE DATA LOCAL
1 #FLD1 (A5) INIT <'AbCdE'>
1 #FLD2 (N5.2) INIT <-12345.67>
END-DEFINE
DISPLAY 'Field 1' #FLD1
        'Field 2' #FLD2
*
WRITE TITLE LEFT 'Listing A' /
END
```

```auto
Listing A
 
Field 1 Field 2
------- ---------
 
AbCdE -12345.67
```

Solution 2 - Report Header

```auto
DEFINE DATA LOCAL
1 #GRP (HD='Listing A')
  2 #FLD1 (A5) INIT <'AbCdE'> (HD='Field 1')
  2 #FLD2 (N5.2) INIT <-12345.67> (HD='Field 1')
END-DEFINE
DISPLAY #GRP
END
```

```auto
Page 1 02/20/19 08:03:33
 
    Listing A
 
Field 1 Field 1
------- ---------
 
AbCdE -12345.67
```

Solution 3 - At Top of Page

```auto
DEFINE DATA LOCAL
1 #FLD1 (A5) INIT <'AbCdE'>
1 #FLD2 (N5.2) INIT <-12345.67>
END-DEFINE
DISPLAY 'Field 1' #FLD1
        'Field 2' #FLD2
*
AT TOP OF PAGE
WRITE 'Listing A' /
END-TOPPAGE
END
```

```auto
Page 1 02/20/19 08:07:18
 
Listing A
 
Field 1 Field 2
------- ---------
 
AbCdE -12345.67
```

If you really want ‘Listing A’ to appear only once, not at the top of each page, then add a switch.

```auto
DEFINE DATA LOCAL
1 #FLD1 (A5) INIT <'AbCdE'>
1 #FLD2 (N5.2) INIT <-12345.67>
1 #ONCE (L) INIT <TRUE>
1 #I (I4)
END-DEFINE
FORMAT PS=10
*
FOR #I = 1 5
  DISPLAY #I
          'Field 1' #FLD1
          'Field 2' #FLD2
END-FOR
*
AT TOP OF PAGE
IF #ONCE
  THEN
    WRITE 'Listing A' /
END-IF
RESET #ONCE
END-TOPPAGE
END
```

```auto
Page 1 02/20/19 08:13:21
 
Listing A
 
    #I Field 1 Field 2
----------- ------- ---------
 
          1 AbCdE -12345.67
          2 AbCdE -12345.67
          3 AbCdE -12345.67
Page 2 02/20/19 08:13:21
 
    #I Field 1 Field 2
----------- ------- ---------
 
          4 AbCdE -12345.67
          5 AbCdE -12345.67
```

---

<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:** [February 21, 2019, 2:36am UTC](https://techcommunity.softwareag.com/t/display-1-function/202882/3 "2019-02-21T02:36:30Z")

</div>

or, if you just want “Listing A” once -

```auto

DEFINE DATA LOCAL  
1 #FLD1 (A5) INIT <'AbCdE'>  
1 #FLD2 (N5.2) INIT <-12345.67>  
1 #I (I4)  
END-DEFINE  
FORMAT PS=10  
*
WRITE 'Listing A' /  
*  
FOR #I = 1 5  
  DISPLAY #I  
          'Field 1' #FLD1  
          'Field 2' #FLD2  
END-FOR  
*  
END  
```

No switch needed. Depends on what you really need to do…

---

<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:** [April 2, 2021, 3:42pm UTC](https://techcommunity.softwareag.com/t/display-1-function/202882/4 "2021-04-02T15:42:21Z")

</div>


