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

How to update a portion of text in a trailer record


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

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Wed Nov 09, 2016 9:41 pm
Reply with quote

Hi Team,

I'm trying to update a portion of a trailer record and facing error.
Can you please let me know how to achieve this?

Sort Card:

Code:
OUTFIL FNAMES=01,                         
   INCLUDE=(25,3,CH,EQ,C'XXX'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR1',30:COUNT=(M11,LENGTH=4)))   
OUTFIL FNAMES=02,                         
   INCLUDE=(25,3,CH,EQ,C'YYY'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR2',30:COUNT=(M11,LENGTH=4)))   
OUTFIL FNAMES=03,                         
   INCLUDE=(25,3,CH,EQ,C'ZZZ'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR3',30:COUNT=(M11,LENGTH=4)))


Code'd
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Nov 09, 2016 9:55 pm
Reply with quote

Quote:
I'm trying to update a portion of a trailer record and facing error.
We don't do guess work here , please post complete requirement and the error messages to get answers.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Wed Nov 09, 2016 10:15 pm
Reply with quote

Apologies Rohit.
Please refer the below info required.

Input File:

Code:
HDRABC09112016
DATABCDEFGHIJKLMNOPQRSTUXXX
DATFSSFSAAKXCNVXPQWAAZXAZZZ
DATTWTELELELSFSAFAAFFDGDYYY
DATSFDSKKSGKDGDDKKGDKKDGZZZ
DATZFGHSDKGSHSGSGLJSLSFSXXX
DATCXHIUYTRNVMBIOPZSERFVZZZ
ZZZ TRAIL                      0006 

Output File 1:
Code:
HDRABC09112016
DATABCDEFGHIJKLMNOPQRSTUXXX
DATZFGHSDKGSHSGSGLJSLSFSXXX
TR1 TRAIL                      0002

Output File 2:
Code:
HDRABC09112016
DATTWTELELELSFSAFAAFFDGDYYY
TR2 TRAIL                      0001

Output File 3:
Code:
HDRABC09112016
DATFSSFSAAKXCNVXPQWAAZXAZZZ
DATCXHIUYTRNVMBIOPZSERFVZZZ
TR3 TRAIL                      0002

I'm facing U007 error when trying to modify the string present in position 1 using TRLUPD=(1:C'TR1',30:COUNT=(M11,LENGTH=4)
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 09, 2016 10:58 pm
Reply with quote

Rohit asked for the messages. "I'm facing U007 error" is not the messages. Paste the full SYSOUT for the step.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Nov 09, 2016 11:07 pm
Reply with quote

Code:
OUTFIL FNAMES=01
'FNAMES' goes with ddnames used in the JCL whereas OUTFIL 'FILES' go with JCL dd suffixes such as '01' or '02' or '03'. And your ddnames in the JCL should be consistent with these.

So if you have output ddnames in the JCL as
Code:
//SORTOF01 DD DSN=...,
//SORTOF02 DD DSN=...,
//SORTOF03 DD DSN=...,
either use
Code:
OUTFIL FILES=01,...
OUTFIL FILES=02,...
OUTFIL FILES=03,...
OR
Code:

OUTFIL FNAMES=SORTOF01,...
OUTFIL FNAMES=SORTOF02,...
OUTFIL FNAMES=SORTOF03,....
I would not recommend the latter if you have SORTOFnn DDs because that is the whole purpose of having "FILES=nn"

While we wait for the complete SYSOUT messages, it might be worth verifying this in your JCL and control statements.

Also your control statements look for XXX,YYY OR ZZZ at position-25 to route to each output file, but in the sample input shown there is only ZZZ.
Can you also include a sample input representative enough to have data written into all the output files?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Nov 09, 2016 11:58 pm
Reply with quote

I don't think you can use 1:C'TR1' in TRLUPD, you may have to find another way to overlay in the trailer.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 10, 2016 6:28 pm
Reply with quote

Did you read my previous post? It might not help if you do not post the relevant sysout messages and the JCL. When I ran your control statements as is, I am getting other syntax errors that do no appear in the SYSOUT from your last post.
Code:
            OPTION COPY         
            OUTFIL FNAMES=01,   
                          $     
ICE007A 0 SYNTAX ERROR         

Also, There was a question about the requirement which you have not responded to.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Thu Nov 10, 2016 7:46 pm
Reply with quote

Arun, the SORT FIELDS=COPY is missing in the control card which I pasted in my earlier post.

The sample input file has records with XXX, YYY and ZZZ, I'm not sure what is missing there. I think this could be with the spaces as I've copied the text from notepad.

Input File:


Code:
HDRABC09112016
 DATABCDEFGHIJKLMNOPQRSTUXXX
 DATFSSFSAAKXCNVXPQWAAZXAZZZ
 DATTWTELELELSFSAFAAFFDGDYYY
 DATSFDSKKSGKDGDDKKGDKKDGZZZ
 DATZFGHSDKGSHSGSGLJSLSFSXXX
 DATCXHIUYTRNVMBIOPZSERFVZZZ
ZZZ TRAIL                      0006
 


I'm facing issue when I try to modify using 1:'TR1' in TRLUPD.

As far I know the OVERLAY command used with IFTRAIL, ignores the trailer record.

Is there any other way I could achieve this.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 10, 2016 7:55 pm
Reply with quote

Quote:
The sample input file has records with XXX, YYY and ZZZ

You're right. I was looking at pos-1 instead, my bad. I got errors with the FNAMES=01. Was wondering how it worked for you. Can you show your JCL DDnames?
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Thu Nov 10, 2016 8:10 pm
Reply with quote

Its ok.

I've used FILES instead of FNAMES. Can you please give a try using this.
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: Thu Nov 10, 2016 8:33 pm
Reply with quote

Trinadh,

I know you are capable with SORT, and usually work with SyncSORT.

Now you come here "unable to show the SYSOUT", with FNAMES= which gives a syntax error (and masses of other errors subsequent to that) and continue to insist that the error-marker points to the 30:.

Can you at least post the entire ICE201I messge, or if not, the first non-blank character after the message-number?

Did you read Rohit's post about the "1:C'"?

What's going on?

You are going to have to make that change on INREC or OUTREC.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 10, 2016 8:42 pm
Reply with quote

Quote:
I've used FILES instead of FNAMES
Still your latest control card has FNAMES. It does not help if you are not showing what you actually tried.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Thu Nov 10, 2016 11:58 pm
Reply with quote

Arun,

I've tried the following the code

Code:
SORT FIELDS=COPY
OUTFIL FILES=01,                         
   INCLUDE=(25,3,CH,EQ,C'XXX'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR1',30:COUNT=(M11,LENGTH=4)))   
-----------------$
ICE007A SYNTAX ERROR
OUTFIL FILES=02,                         
   INCLUDE=(25,3,CH,EQ,C'YYY'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR2',30:COUNT=(M11,LENGTH=4)))   
-----------------$
ICE007A SYNTAX ERROR
OUTFIL FILES=03,                         
   INCLUDE=(25,3,CH,EQ,C'ZZZ'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR3',30:COUNT=(M11,LENGTH=4)))
 -----------------$
ICE007A SYNTAX ERROR

The marker has been pointed at "1:C", somehow it is showing at 30 when I pasted the content from notepad to this post.

Bill,

I would post the ICE201I messages tomorrow.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Nov 11, 2016 12:55 am
Reply with quote

The reason of your issue was given by Rohit a long time ago and then Bill reiterated and told you what you need to do:
Quote:
Did you read Rohit's post about the "1:C'"?

What's going on?

You are going to have to make that change on INREC or OUTREC.

I don't understand what is the point of having a further discussion on this?

.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Fri Nov 11, 2016 1:07 am
Reply with quote

Hi Rahul,

I'm aware of what is causing the issue and requesting the group that how I could I achieve this output through INREC or OUTREC along with IFTRAIL
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: Fri Nov 11, 2016 1:12 am
Reply with quote

Again, in either INREC or OUTREC you are going to have to use IFTHEN=(WHEN=(logicalcondition) to make the changes where you want to change other than overlaying COUNT or TOTAL on TRLUPD. Or, if you can otherwise recreate the trailer, drop the original and use TRAILER1 to create a new one.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 11, 2016 1:17 am
Reply with quote

Rahul, there were multiple issues as you might have noticed already - the attempt of overlaying a constant in TRLUPD subparameter, and the usage of FNAMES instead of FILES. And it took several posts to show what was actually tried. At least in his last post he did that.

The OP seems to have solved the FNAMES error, and for the other main problem, Bill has made a clear suggestion but am not sure if it came to the OP's notice. Lets hope if he tries something based on that, and comes up with something.

Another option is to build a new trailer using TRAILER1 in the OUTFIL omitting the existing trailer (assuming other fields are the constants shown in the example) instead of updating the existing trailer using IFTRAIL

EDIT: I think by the time I made this post, 2 other posts came in. Bill-Sorry abt that.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Mon Nov 14, 2016 2:45 pm
Reply with quote

Hi Bill,

I've tried implementing OUTREC IFTHEN code and facing the errors stated below.

Code:
SORT FIELDS=COPY
OUTFIL FILES=01,                         
   INCLUDE=(25,3,CH,EQ,C'XXX'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR1',30:COUNT=(M11,LENGTH=4)))
   OUTREC IFTHEN=(WHEN=((1,3,CH,EQ,C'ZZZ')),
       OVERLAY=(1:C'TR1')) 
OUTFIL FILES=02,                         
   INCLUDE=(25,3,CH,EQ,C'YYY'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR2',30:COUNT=(M11,LENGTH=4)))
OUTREC IFTHEN=(WHEN=((1,3,CH,EQ,C'ZZZ')),
       OVERLAY=(1:C'TR2')) 
$
ICE005A BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTFIL FILES=03,                         
   INCLUDE=(25,3,CH,EQ,C'ZZZ'),               
   IFTRAIL=(HD=YES,TRLID=(5,5,CH,EQ,C'TRAIL'),     
    TRLUPD=(1:C'TR3',30:COUNT=(M11,LENGTH=4)))
OUTREC IFTHEN=(WHEN=((1,3,CH,EQ,C'ZZZ')),
ICE002I DUPLICATE OR CONFLICTING OUTREC STATEMENT
       OVERLAY=(1:C'TR3'))
$
ICE005A BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY

I tried INREC IFTHEN too and facing the same error codes.

Can you please let me know how this can be achieved?

CODE' d
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: Mon Nov 14, 2016 3:34 pm
Reply with quote

Has someone hijacked your account, or your name? I suppose if someone has, they're hardly going to say "yes". Or, I'm beginning to believe, I have been mislead by "3NADH" into thinking you are someone else :-)

Anyway. Sort control cards can't start in column one.

This isn't you, is it?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Nov 14, 2016 7:11 pm
Reply with quote

Quote:
I tried INREC IFTHEN too and facing the same error codes
One of the suggestions made earlier was to have a separate INREC/OUTREC (and this can occur only once per control card), so you cannot embed this into each of your OUTFIL groups.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Mon Nov 14, 2016 7:13 pm
Reply with quote

Hi Bill,

I've given the sort control cards from position 2 only. I think this is a problem with my editor, as I'm coding it here directly instead of pasting the content.

The $ sign is showing at OVERLAY statement.

I'm sure that the error is causing due to the multiple OUTRECS coded in each OUTFIL.

When I removed the OUTREC in OUTFIL FILES =02 and 03, it is working fine.

But couldn't succeed ahead.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Nov 14, 2016 7:28 pm
Reply with quote

Quote:
When I removed the OUTREC in OUTFIL FILES =02 and 03, it is working fine
Are you sure, it is giving you the expected results? If it does not, then it IS NOT 'working fine'.

If you are ok to build a new trailer, and skip the original trailer, this might help, and maybe easier to understand. This is the alternative explained earlier in this thread.
Code:
//SYSIN    DD *                                       
 OMIT COND=(5,5,CH,EQ,C'TRAIL')                       
 SORT FIELDS=COPY                                     

 OUTFIL FILES=01,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'XXX'), 
 TRAILER1=('TR1 TRAIL',30:COUNT-1=(M11,LENGTH=4))     

 OUTFIL FILES=02,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'YYY'), 
 TRAILER1=('TR2 TRAIL',30:COUNT-1=(M11,LENGTH=4))     

 OUTFIL FILES=03,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'ZZZ'), 
 TRAILER1=('TR3 TRAIL',30:COUNT-1=(M11,LENGTH=4))     
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: Mon Nov 14, 2016 10:16 pm
Reply with quote

Although you can have multiple OUTFIL statements, you can only have one OUTREC.

Just define one OUTREC, which will change the trailer text, then all you OUTFILs will get data with the changed result.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Tue Nov 15, 2016 7:36 pm
Reply with quote

Thanks Arun, that way it worked successfully.

Bill,

I came across an example 3 in the below link of using multiple OUTREC, one for each OUTFIL.
Link: www.ibm.com/support/knowledgecenter/SSLTBW_1.13.0/com.ibm.zos.r13.icea100/ofendex.htm

Also I tried the below code and couldn't get the perfect count in the trailer record after the file split. Assume my input file has 90 records and each split may contain 30 records. The below sort is throwing (no it isn't - it is showing a) record count of 100 in the trailer record in all the three split files.



Code:
 SORT FIELDS=COPY                                     

 OUTFIL FILES=01,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'XXX'),
    IFTHEN=(WHEN=(5,5,CH,EQ,'TRAIL'),
        BUILD=(1:C'TR1',4,26,30,4,UFF,M11,LENGTH=4))
  OUTFIL FILES=02,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'YYY'),
    IFTHEN=(WHEN=(5,5,CH,EQ,'TRAIL'),
        BUILD=(1:C'TR2',4,26,30,4,UFF,M11,LENGTH=4))
 OUTFIL FILES=03,                                     
    INCLUDE=(1,3,CH,EQ,C'HDR',OR,25,3,CH,EQ,C'ZZZ'),
    IFTHEN=(WHEN=(5,5,CH,EQ,'TRAIL'),
        BUILD=(1:C'TR3',4,26,30,4,UFF,M11,LENGTH=4))

Thanks for your help.

RE CODE' D
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 15, 2016 7:53 pm
Reply with quote

Well, no you didn't. OUTREC is a parameter on OUTFIL, is what you discovered in the example. This is entirely different from... OUTREC. Note the comma indicating a continuation. All that OUTREC on OUTFIL is, is BUILD.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 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 Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top