IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Justifying Count Value On Trailer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Tue Nov 18, 2014 9:32 pm
Reply with quote

Hi,

I did quite bit of research on the forum to find a solution for my below query, but could not get an answer for this.

I have a input file of 80 bytes, which has SAY 1000 records in input file.

I need a predefined trailer to be written in the output file as below with the volume(count) of the file which varies daily.

Example:sn_sn1-sxyz345_1000_yyyymmdd_r.txt.

This file would be the ftp destination file to be transmitted to a vendor

1000 is the count of records of the input file, yyyymmdd can be provided from Control M.

The problem is that, i have not been able to left justify the count of records in TRAILER1,

I used the below code in SYSIN Card

SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('sn_sn1-sxyz345_', -
COUNT=(M11,LENGTH=10),C'_',C'20141118',C'_r.txt'),
OVERLAY=(1:1,15,16,10,SQZ=(SHIFT=LEFT,PREBLANK=C'0',LENGTH=10), -
27,53)

For M11, the volume comes as 0000001000 and not as 1000 after OVERLAY
i used M10 in count too, however the count gets right justified and not left justified after OVERLAY

Our DFSORT version is Z/OS DFSORT V1R12, so not sure if its related to the version of DFSORT which is not allowing justify to work.

I am not sure if i combined up OVERLAY with TRAILER1, which is not advisable

Any advice(from past posts)/help would be great!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 18, 2014 10:26 pm
Reply with quote

Advisable is irrelevant, since you can't do that.

To do what you want would require a lot of extra code and processing.

Why not go with sn_sn1-sxyz345_000001000_yyyymmdd_r.txt. The file-system you are sending it to doesn't mind?
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Tue Nov 18, 2014 10:37 pm
Reply with quote

Bill Woodger wrote:
Advisable is irrelevant, since you can't do that.

To do what you want would require a lot of extra code and processing.

Why not go with sn_sn1-sxyz345_000001000_yyyymmdd_r.txt. The file-system you are sending it to doesn't mind?


This is a destination FTP file which needs to be sent to a thirdparty vendor. We had coded the above to include zeroes and was easy as was.

The thirdparty system is on a different platform and it seems, they cannot process the file with these extra zeroes in place.

We had a tough time making them understand on Host, but its how their system works!!

Strange ways !!..Cant help but to change the code!!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 18, 2014 10:59 pm
Reply with quote

OK, I don't believe them, but if you have no choice...

Code:
//SORTIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,1,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(1,1,A)
  JOIN UNPAIRED,ONLY                           
  REFORMAT FIELDS=(F1:1,x,?,F2:1,10)             
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=(x+1,1,CH,EQ,C'1'),
               BUILD=(1,x)),
        IFTHEN=(WHEN=NONE,
               do you stuff to make the trailer))             
//JNF1CNTL DD *                                           
  OPTION COPY                                           
  INREC extend record by one byte, value of X'00'
//JNF2CNTL DD *                                           
  INREC BUILD=(X'FF',C0000000001')
  SORT FIELDS=(1,1,CH,A)
  SUM FIELDS=(2,10,ZD)   
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Nov 19, 2014 12:10 am
Reply with quote

Can we do it in two steps: in the first step use M10 to get leading zeros as blanks and then in next step use: SQZ=(SHIFT=LEFT) to remove them.

Code:
//STEP01   EXEC PGM=SORT                                             
//SORTIN   DD *                                                       
TEST                                                                 
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS)                                 
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
   OPTION COPY                                                       
   OUTFIL REMOVECC,NODETAIL,                                         
          TRAILER1=('SN_SN1-SXYZ345_', -                             
                     COUNT=(M10,LENGTH=10),C'_',C'20141118',C'_R.TXT')
//STEP02   EXEC PGM=SORT                                             
//SORTIN   DD DSN=&&TEMP,DISP=(OLD,PASS)                             
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
   OPTION COPY                                                       
   OUTREC BUILD=(1,80,SQZ=(SHIFT=LEFT))
Back to top
View user's profile Send private message
shajeeth

New User


Joined: 25 May 2005
Posts: 20

PostPosted: Wed Nov 19, 2014 3:06 pm
Reply with quote

Bill Woodger wrote:
OK, I don't believe them, but if you have no choice...

Code:
//SORTIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,1,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(1,1,A)
  JOIN UNPAIRED,ONLY                           
  REFORMAT FIELDS=(F1:1,x,?,F2:1,10)             
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=(x+1,1,CH,EQ,C'1'),
               BUILD=(1,x)),
        IFTHEN=(WHEN=NONE,
               do you stuff to make the trailer))             
//JNF1CNTL DD *                                           
  OPTION COPY                                           
  INREC extend record by one byte, value of X'00'
//JNF2CNTL DD *                                           
  INREC BUILD=(X'FF',C0000000001')
  SORT FIELDS=(1,1,CH,A)
  SUM FIELDS=(2,10,ZD)   


Ideally, would have liked to have a single step driven process output. But it looks a lot of coding.

I will try both options and see how it could be accommodated.

Thanks for your help!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 19, 2014 3:21 pm
Reply with quote

OK. Traditional way. SEQNUM for each record. On each record, further temporarily extend, with your unsequeezed message with the sequence number (use EDIT to get leading blanks, or test thoroughly with PREBLANK :-) ) and then SQZ. It's code and it's time.

There's an example by Arun Raj in the JCL part of the forum of editing the value on a TRAILER1.

Another way is a dummy trailer concatenated to your input. Again SEQNUM per reocrd. When the dummy trailer arrives, take the sequence, format the message and SQZ. Ditch the TRAILER1.

On the receiver, likely some *nix/*nux machine, possibily Windows something, if they already have code to take the filename and use the numeric as data, I really can't believe it is not the work of a moment to have that with leading zeros.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Quantifying/Justifying CPU savings All Other Mainframe Topics 2
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
Search our Forums:

Back to Top