Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Justifying Count Value On Trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Justifying Count Value On Trailer
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Nov 18, 2014 10:26 pm    Post subject: Reply to: Justifying Count Value On Trailer
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    Post subject: Re: Reply to: Justifying Count Value On Trailer
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Nov 18, 2014 10:59 pm    Post subject: Reply to: Justifying Count Value On Trailer
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: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Nov 19, 2014 12:10 am    Post subject: Reply to: Justifying Count Value On Trailer
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    Post subject: Re: Reply to: Justifying Count Value On Trailer
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Wed Nov 19, 2014 3:21 pm    Post subject: Reply to: Justifying Count Value On Trailer
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Coverting PD to FS and also left just... Atul Banke DFSORT/ICETOOL 6 Wed Aug 24, 2016 4:31 pm
No new posts Update the Sortout file with record c... karthik_sripal SYNCSORT 8 Tue May 17, 2016 8:52 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us