Your suspicions were quite correct.  After some futzing around the opening 
logic finally does:


 if ((pcapfd = fopen("DD:PCAPFN", "ab+,lrecl=1")) == NULL) {

which looks like it must takes precedence over the OTRUNC.
Many thanks for pointing me in the right direction.


Best wishes / Mejores deseos /  Meilleurs vœux

Ian ... 

    On Friday, December 9, 2022 at 05:37:54 PM GMT+1, Paul Gilmartin 
<[email protected]> wrote:  
 
 On Fri, 9 Dec 2022 08:54:03 +0000, Ian Worthington wrote:

>When I run JCL with
>//PCAPFN DD PATHOPTS=(OCREAT,ORDWR,OTRUNC),   
>// PATHMODE=..., PATH=...             // FILEDATA='BINARY'
>
>any existing file gets extended.  Yet
>
What program did you name on the EXEC PGM= statement?
It's possible that the program overrides PATHOPTS.  (It shouldn't
matter if step initiation performs an open() with the coded PATHOPTS.)

How do other programs behave?:
o IEBGENER SYSUT2?
o IEFBR14?  (Is the truncation performed at open() or at the first write()?)

>https://www.ibm.com/docs/en/zos/2.4.0?topic=definition-status-group
> clearly states that:
>  
>  - OTRUNC
>      - Specifies that the system is to truncate the file length tozero if all 
>the following are true:      
>      - The file specified on the PATH parameter exists.
>      - The file is a regular file.
>      - The file successfully opened with ORDWR or OWRONLY.

-- 
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
  

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to