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

SYNCSORT SEQNUM and FI fields.


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Jan 21, 2017 4:02 am
Reply with quote

I have the following table layout from DSNTIAUL:

Code:
LOAD DATA LOG NO INDDN SYSREC00 INTO TABLE
    TBLNAME
 (
 TEST__ID                               POSITION(       1         )
 INTEGER                       ,
 TEST_SID                               POSITION(       5         )
 SMALLINT                      ,
 TEST_DTE                               POSITION(       7         )
 DATE EXTERNAL(            10) ,
 TEST_TME                               POSITION(      17         )
 TIME EXTERNAL(             8) ,
 TEST_FORM_ID                           POSITION(      25         )
 INTEGER                       ,
 TEST_USR_ID                            POSITION(      29         )
 INTEGER
 )


What I am doing is, to sequence the SID number after unloading the table in a flat file.

Code:
//SYSIN    DD   *
  SORT FIELDS=(1,4,FI,A,5,2,FI,A)
  OUTREC IFTHEN=(WHEN=INIT,
                 OVERLAY=(5:SEQNUM,2,BI,RESTART=(1,4)))
  OUTFIL BUILD=(1,80)
/*


Apparently, this code wouldn't work, because format FI ( equivalent of smallint ) is not supported in SEQNUM field. Do you have any suggestion on how do I get around this problem? We are using SYNCSORT 2.1.0

After I sequence the SID, I would be reloading the data back to the table.
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: Sat Jan 21, 2017 6:05 am
Reply with quote

What do you mean by "apparently, this code wouldn't work"?

Do you have more than a possible 32767 TEST_SID per TEST__ID? If not, what do you feel would be the difference between FI and BI, and if so, how would a signed "sequence number" help?
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Jan 21, 2017 6:08 am
Reply with quote

Bill Woodger wrote:
What do you mean by "apparently, this code wouldn't work"?

Do you have more than a possible 32767 TEST_SID per TEST__ID? If not, what do you feel would be the difference between FI and BI, and if so, how would a signed "sequence number" help?


Sorry for the confusion. I am attaching the code,which i submitted. Ignore the code shown in previous post.

Code:

//SYSIN    DD   *
  SORT FIELDS=(1,4,FI,A,5,2,FI,A)
  OUTREC IFTHEN=(WHEN=INIT,
                 OVERLAY=(5:SEQNUM,2,FI,RESTART=(1,4)))
  OUTFIL BUILD=(1,80)
/*


What i mean is, i submitted this job, and it gave "Syntax error". Going through the manual, it said FI is not supported for SEQNUM. Only BI, ZD and PD values are supported.

The problem with BI is that when i reload back to the table, it has to be converted back to FI, if i understand correctly. Is there an easy way to handle this, other than doing through 2 steps.
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: Sat Jan 21, 2017 7:27 am
Reply with quote

If you needed to "convert" it could be done with another simple WHEN=INIT in the OUTREC.

You've avoided the other questions. If you "smallint" can only be positive, there is no difference between BI and FI. If your sequence can... "go negative", what would that mean?
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Sat Jan 21, 2017 7:49 am
Reply with quote

Bill Woodger wrote:
If you needed to "convert" it could be done with another simple WHEN=INIT in the OUTREC.

You've avoided the other questions. If you "smallint" can only be positive, there is no difference between BI and FI. If your sequence can... "go negative", what would that mean?


The value in small int is from 1 to 32767.. no negative values in db. Let me try to run the job next Monday and post the results here.
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: Sat Jan 21, 2017 12:58 pm
Reply with quote

FI is signed. -32,768 to +32,767. BI is unsigned. 0-65,535. If you don't have negative sequence numbers, and if they can't exceed 32,767, for your specific purpose FI and BI are the same, and you will have no problems.
Back to top
View user's profile Send private message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Wed Jan 25, 2017 12:19 am
Reply with quote

Thanks Bill. I changed the query from FI to BI and it worked seamlessly. I will take some time to refresh my memory on FI and BI data formats.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Feb 02, 2017 10:27 pm
Reply with quote

nartcr wrote:
I will take some time to refresh my memory on FI and BI data formats.

The idea of "unsigned binary" is known mainly among SYNCSORT/Assembler. AFAIK the most of other tools do only consider "signed binary".

The "FI,2" in SYNCSORT is equivalent to "DS H" in Assembler, and SMALLINT in DB2.
The "BI,2" in SYNCSORT is usually equivalent to "DS AL2", or "DS XL2" in Assembler, and nothing in DB2.

Any value between +32,768 to +65,535 appeared as "unsigned binary" is valid as "signed binary", too, but considered as values between -32,768 to -1 (in descending order).

The values between 0 to +32767 are absolutely equivalent in both cases. It's very unlikely that the noted TEST_SID would exceed +32767. Even if it does, I bet it is used for the purposes of uniqueness within the same TEST_ID value, so it should not harm anything.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top