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
 

 

How to determine Length of the output record in the JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Fri Sep 21, 2007 6:05 pm    Post subject: How to determine Length of the output record in the JCL
Reply with quote

Hi,
I am using a sort JCL and populating the output file using some conditions.
The code in the JCL is as below:

Code:

//SORTIN   DD DSN=A030986.TEST.SORTIN.FILE1,
//            DISP=SHR                       
//*                                         
//SORTOUT  DD DSN=A030986.TEST.SORTOUT.FILE1,
//            DISP=(NEW,CATLG,DELETE),       
//            UNIT=SYSDA,                   
//            SPACE=(TRK,(5,5),RLSE),       
//            DCB=*.SORTIN                   
//*                                         
//SYSPRINT DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1:C'  ',3:1,2,X'40',6:3,78)
/*


The sample output of the above is:
55 545164
64 683646
31 23111124
11 11

Now, I want to add a step which can count the length of each record.
So, please suggest a method for the same.

Thanks
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Sep 21, 2007 6:12 pm    Post subject:
Reply with quote

Nayanish,

Quote:
Now, I want to add a step which can count the length of each record.

What is the file format? (FB/VB)
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Sep 21, 2007 7:50 pm    Post subject:
Reply with quote

murmohk1 wrote:
Nayanish,

Quote:
Now, I want to add a step which can count the length of each record.

What is the file format? (FB/VB)


Based on
Code:
OUTREC FIELDS=(1:C'  ',3:1,2,X'40',6:3,78)

the records are FB with a length of at least 83.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 21, 2007 9:09 pm    Post subject:
Reply with quote

Quote:
Now, I want to add a step which can count the length of each record.


Nayanish Patil,

Your OUTERC statement sets the length of every record to 83 bytes.

By the "length of each record" do you mean the position of the last non-blank character in each record (e.g. the position of the last '4' in the first record), or do you mean something else? If you mean something else, please explain exactly what you mean.

Please show what you expect for output.

Also, give the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Mon Sep 24, 2007 10:27 am    Post subject:
Reply with quote

The Input record length is 80 and Fixed Block.
The Output record length is 83 and also Fixed Block.

Yeah, I want to add another step which will count until the last non-blank character in each record, and as you said after 4 in case of 1st record.

But, we should take a note that the output generated also has some spaces in between.

The next step which I want to add should count until the last character, and if the record length is say 9 (including any spaces in between), then I intend to perform some function on that output record and write to some other file.

I hope the above details make the probelm statement more clear.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Sep 24, 2007 8:08 pm    Post subject:
Reply with quote

It's not clear if you just want the "length" in the output record, or you want the characters and the length, or what.

Again, please show the expected output records for your example input records.

And please put code tags around your examples.
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Mon Sep 24, 2007 11:39 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
It's not clear if you just want the "length" in the output record, or you want the characters and the length, or what.


I want to get the total length of each output record, ie total number of characters of each output record (including any in between spaces).

Frank Yaeger wrote:

Again, please show the expected output records for your example input records.


From the sample output:
nayanishpatil wrote:

55 545164
64 683646
31 23111124
11 11


say for the first record, the total length comes out to be 12 (going as per the OUTREC condition of JCL), then the step which I want to add should be able to give me 12 as the result of first output record.
Based on this, if the length is 12 then I can write another output file and for the record with lenght 9 or 8 or 5, I can do some other operations.

I hope that this information is more clear than the earlier ones. icon_rolleyes.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Sep 24, 2007 11:46 pm    Post subject:
Reply with quote

Hello,

How does this "55 545164" give this
Quote:
say for the first record, the total length comes out to be 12

The first output record appears to have 9 characters icon_confused.gif

Please explain why your descriptin does not match your data. . .
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 25, 2007 12:05 am    Post subject:
Reply with quote

Quote:
The first output record appears to have 9 characters


You can see that I have written
Quote:
the total length comes out to be 12 (going as per the OUTREC condition of JCL)
,
due to some problem in posting, I am unable to see the initial spaces,

which accoring to the OUTREC conditin in JCL
Quote:
OUTREC FIELDS=(1:C' ',3:1,2,X'40',6:3,78)


should be 1+2 = 3 spaces, then followed by 55 545164. Now I hope that my description does matches with my data. icon_neutral.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 25, 2007 12:18 am    Post subject:
Reply with quote

Hello,

To preserve multiple spaces in your posted data, use the "Code" tab instead of the "Quote" tab.

Code:
   55 545164
   64 683646
   31 23111124
   11 11


Quote:
the total length comes out to be 12 (going as per the OUTREC condition of JCL)
I see nothing in your JCL/sort control info that would cause an output lrecl of 12 icon_confused.gif
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Tue Sep 25, 2007 12:30 am    Post subject:
Reply with quote

Code:

OUTREC FIELDS=(1:C' ',3:1,2,X'40',6:3,78)


The above code in the JCL moves one space at the begining, then moves 2 spaces instead of the first two characters of input record, and the remainging 9 characters of the record are moved as such.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Sep 25, 2007 1:35 am    Post subject:
Reply with quote

Quote:
I hope that this information is more clear than the earlier ones


Nayanish,

I understand what you want to do (I have for a while now). What I don't know is what you want the output to look like. That's what I want an example of. For example, do you want the output records to contain:

Code:

00012
00009
00008
...


or

Code:

12
09
08
...


or

Code:

12
9
8
...


or something else?
Back to top
View user's profile Send private message
nayanishpatil

New User


Joined: 16 Aug 2007
Posts: 14
Location: INDIA

PostPosted: Thu Sep 27, 2007 10:01 am    Post subject:
Reply with quote

Hi Frank,

What I want is that once the record length is known, based on that i want to move that record into a file.

For a set of records whose record length is say 12, I want to write to a file say File-1.

For a set of records whose record length is less than 12, I want to write them into another file, say File-2.

And similarly, for those records whose record length is greater than 12, I want to write into a third file, say File-3.

I hope this would be more clear. icon_rolleyes.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 27, 2007 8:54 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN   DD DSN=A030986.TEST.SORTIN.FILE1,
//            DISP=SHR
//*
//SORTOUT  DD DSN=A030986.TEST.SORTOUT.FILE1,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(5,5),RLSE),
//            DCB=*.SORTIN
//*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  SORT FIELDS=COPY
  OUTREC FIELDS=(1:C'  ',3:1,2,X'40',6:3,78)
  OUTFIL FNAMES=SORTOUT
  OUTFIL FNAMES=T1,FTOV,BUILD=(1,83),VLTRIM=C' '
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//OUTLT12 DD DSN=...  output file1 (<12) - FB/83
//OUTEQ12 DD DSN=...  output file2 (=12) - FB/83
//OUTGT12 DD DSN=...  output file3 (>12) - FB/83
//SYSIN    DD    *
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUTLT12,INCLUDE=(1,2,BI,LT,16),
    VTOF,BUILD=(5,83)
  OUTFIL FNAMES=OUTEQ12,INCLUDE=(1,2,BI,EQ,16),
    VTOF,BUILD=(5,83)
  OUTFIL FNAMES=OUTGT12,INCLUDE=(1,2,BI,GT,16),
    VTOF,BUILD=(5,83)
/*
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 add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts JES2 doesn't honor the priority of th... Aron Lendvai JCL & VSAM 7 Thu Jun 29, 2017 1:41 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm


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