DBSQLPR does not honour large PRTWIDTH for CSV output file
search cancel

DBSQLPR does not honour large PRTWIDTH for CSV output file

book

Article ID: 238541

calendar_today

Updated On:

Products

Datacom

Issue/Introduction

Executing DBSQLPR to create a CSV output file using options DATASEPARATOR= and PRTWIDTH=4001 fails with                         

USE PRTWIDTH 4001 TO PRINT 10 ROWS THAT ARE TOO LONG.     
SQL STMT EXCEEDS 0 CHARACTER(S)  

It is ignoring the PRTWIDTH option and allocating the file with a LRECL=1024

 

Environment

Release : 15.1

Component : DATACOM SQL

Cause

The problem occurs when no LRECL is specified for the output file.
When DATASEPARATOR= is used, DBSQLPR uses the LRECL of the file to set PRTWIDTH. So an LRECL needs to be specified, if not it will default  to the default for SMS, usually 1024.

This is mentioned in the documentation section DBSQLPR Utility--Execute SQL through Datacom/DB 

 DATASEPARATOR=c 
 ..
 Since output is often directed to a file, and a line is truncated based on the file's LRECL record length, PRTWIDTH is set to LRECL. This even occurs with print output.

Resolution

To resolve the problem specify an LRECL parameter on the output file in the JCL (default is STDOUT) using the length specified in the error message. In this case it says to use 4001, so specify LRECL=4001 to resolve the problem. DBSQLPR will then set PRTWIDTH to 4001.

If using a variable record format output file then add 4 bytes to the length to account for the RDW. In this case adding 4 makes the record length 4005. So specify LRECL=4005 instead.