Page 1 of 1

Download table with comp-3 fields

PostPosted: Wed Feb 24, 2021 9:38 pm
by makdiver
Hi,

I want to download a table with some fields like this PIC S9(14)V9(4) USAGE COMP-3.

With my normal procedure I'll get (1.....ïÊÀ-ýT....&)

Is it possible to do something special in my JCL, so that these fields will come our readable ?

Thanks

Michael

Re: Download table with comp-3 fields

PostPosted: Thu Feb 25, 2021 1:25 am
by sergeyken
1. You probably need not to “download” your table, but instead to “unload” it, correct?

2. JCL has absolutely nothing to do with either of the processes: unload, or download.

3. To unload any table from DB2 one of available DB2-related utilities should be used. Most of those utilities do have their own options, to define what is the required fields format after unloading.

Hope this helps to start with.

Re: Download table with comp-3 fields

PostPosted: Thu Feb 25, 2021 5:22 am
by sergeyken
Since there is no reaction to the given primary recommendations, here is the next clue.

Please, present at this forum any information on:
1) which particular utility you are using to unload your table?
2) what code is used to call this utility? It may be either JCL, or many other options are available. Please, provide the code used to invoke that utility, and do not forget to use code tags in your examples.
3) please, investigate, and present here the utility options used in your examples.

After all, or part of such information becomes available, there is a chance that some experts would give you a useful advise on your issue.

Re: Download table with comp-3 fields

PostPosted: Thu Feb 25, 2021 12:12 pm
by makdiver
Hi,

you're right - it^s more an unload than a download...

I do it this way

//STEP0010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (TMAK.SYSREC.T0050TEP.NRTBE) NVSAM
DELETE (TMAK.SYSPUN.T0050TEP) NVSAM
IF MAXCC=8 THEN SET MAXCC=0
/*
//STEP0020 EXEC DSNUPROC,SYS='D2BB'
//*
//SYSREC DD DSN=TMAK.SYSREC.T0050TEP.NRTBE,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(200,100),RLSE),AVGREC=U
//*
//SYSPUNCH DD DSN=TMAK.SYSPUN.T0050TEP,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(200,100),RLSE),AVGREC=U
//*
//SYSIN DD *
UNLOAD DATA FROM TABLE ANJA1E.T0050TEP;
WHEN (STICHTAG = '2021-02-23')
/*

With that procedure I have my data in TMAK.SYSREC.T0050TEP.NRTBE - with the problem, that I can't read the comp-3 fields.

Re: Download table with comp-3 fields

PostPosted: Thu Feb 25, 2021 6:23 pm
by sergeyken
First of all, you ignore recommendations to use code tags to post your code examples.

Did you try to do some search, either in this forum, or in Google? There are tons of examples, guides, and explanations of exactly the same, and similar issues.
For instance, My requirement to unload a table data in readable format, and thousands of other examples.

Re: Download table with comp-3 fields

PostPosted: Thu Feb 25, 2021 8:19 pm
by sergeyken
Your presentation must look in this way:

//STEP0010  EXEC PGM=IDCAMS                                  
//SYSPRINT  DD SYSOUT=*                                      
//SYSIN     DD *                                              
    DELETE (TMAK.SYSREC.T0050TEP.NRTBE) NVSAM        
    DELETE (TMAK.SYSPUN.T0050TEP) NVSAM              
    IF MAXCC=8 THEN SET MAXCC=0                              
/*                                                            
//STEP0020  EXEC DSNUPROC,SYS='D2BB'                          
//*                                                          
//SYSREC    DD DSN=TMAK.SYSREC.T0050TEP.NRTBE,      
//             DISP=(,CATLG,DELETE),                          
//             SPACE=(CYL,(200,100),RLSE),AVGREC=U            
//*                                                          
//SYSPUNCH  DD DSN=TMAK.SYSPUN.T0050TEP,            
//             DISP=(,CATLG,DELETE),                          
//             SPACE=(CYL,(200,100),RLSE),AVGREC=U            
//*                                                          
//SYSIN     DD *                                              
 UNLOAD DATA  FROM TABLE ANJA1E.T0050TEP;                    
              WHEN (STICHTAG = '2021-02-23')                  
/*


I demonstrates, that you have not a minor idea how things work.

1) The step with IDCAMS has no direct relation to the unload operation itself; it cannot affect the way to resolve your issue.
2) The UNLOAD operation provided by DSNUPROC procedure is extremely limited in available options to control the output dataset format.
3) The semicolon at the end of the first UNLOAD statement line seems to be either syntax error, or misleading.
4) When using DSNUPROC/UNLOAD you may need one extra step (of SORT utility, or FILEAID, or whatever else), - to convert output data format(s) to what you really need.
5) The //SYSPUNCH DD defines the dataset to save an optional LOAD statement, for future reload of unloaded data back to DB2 tables. It needs to be RECFM=FB,LRECL=80, and its maximum possible SPACE=(TRK,(1,1)), but not SPACE=(CYL,(100,200))
6) Since you are not going to re-load the data back to DB2, but instead planning to convert data format(s), the //SYSPUNCH DD dataset is not required at all.
7) More convenient way to unload data in printable format would be using other utilities, like DSNTIAUL, or HPU (PGM=INZUTILB, High Performance Utility), or FileAid/DB2, or others, which do have their own options to specify the unloaded fields formats.
8) None of JCL options can affect the way how DB2 table is unloaded; this is 100% internal issue of the utility used to unload data.

Unfortunately, from the first sight it's getting clear that the presented example of JCL code has been copied-and-pasted from unknown source, without a minor attempt to understand it...